Part Number Hot Search : 
S93C56 D4148W DT70T D4148W SD172704 DB103 XC6215 SZN5108
Product Description
Full Text Search
 

To Download M34519M6-XXXFP Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rene s a s 4-bit c i sc s in g le- c hip mi c r oco mp u te r 72 0 family / 4 500 s erie s 4519 group 4 rev. 1.00 revision date: aug 06, 2004 user's manual www.renesas.com before using this material, please visit our website to confirm that this is the most current document available. rej09b0175-0100z
keep safety first in your circuit designs! notes regarding these materials 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with ap- propriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non- flammable material or (iii) prevention against any malfunction or mishap. 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts, pro- grams, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, pro- grams and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers con- tact renesas technology corp. or an authorized renesas technology corp. product dis- tributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by vari- ous means, including the renesas technology corp. semiconductor home page (http:// www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all informa- tion as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liabil- ity or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or repro- duce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be im- ported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/ or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein.
revision history rev. date description page summary 4519 group user? manual 1.00 aug 06, 2004 first edition issued
this user? manual consists of the following three chapters. refer to the chapter appropriate to your conditions, such as hardware design or software development. 1. organization chapter 1 hardware this chapter describes features of the microcomputer and operation of each peripheral function. chapter 2 application this chapter describes usage and application examples of peripheral functions, based mainly on setting examples of related registers. chapter 3 appendix this chapter includes necessary information for systems development using the microcomputer, such as the electrical characteristics, the list of registers. as for the mask rom confirmation form, the rom programming confirmation form, and the mark specification form which are to be submitted when ordering, refer to the ?enesas technology corp.?hompage (http:/ /www.renesas.com/en/rom). as for the development tools and related documents, refer to the product info - 4519 group (http:// www.renesas.com/eng/products/mpumcu/specific/lcd_mcu/expand/e4519.htm) of ?enesas technology corp.?homepage. before using this user? manual
rev.1.00 aug 06, 2004 4519 group i rej09b0175-0100z table of contents chapter 1 hardware description ............................................................................................................................... . 1-2 features ............................................................................................................................... ....... 1-2 application ............................................................................................................................... . 1-2 pin configuration .................................................................................................................. 1-2 block diagram ......................................................................................................................... 1-3 performance overview ....................................................................................................... 1-4 pin description ........................................................................................................................ 1-5 multifunction ..................................................................................................................... 1-6 definition of clock and cycle ................................................................................. 1-6 port function .................................................................................................................... 1-7 connections of unused pins ..................................................................................... 1-8 port block diagrams ..................................................................................................... 1-9 function block operations ........................................................................................... 1-17 cpu ............................................................................................................................ .............. 1-17 program memory (rom) ............................................................................................... 1-20 data memory (ram) ......................................................................................................... 1-21 interrupt function ....................................................................................................... 1-22 external interrupts .................................................................................................... 1-26 timers ............................................................................................................................... .... 1-31 watchdog timer .............................................................................................................. 1-45 a/d converter (comparator) ................................................................................... 1-47 serial i/o .............................................................................................................................. 1 -53 reset function ................................................................................................................ 1 -58 voltage drop detection circuit ........................................................................... 1-62 ram back-up mode .......................................................................................................... 1-63 clock control ................................................................................................................. 1-68 rom ordering method ....................................................................................................... 1-71 list of precautions ............................................................................................................ 1-72 control registers .............................................................................................................. 1-78 instructions ............................................................................................................................ 1-8 5 symbol ............................................................................................................................... ... 1-85 index list of instruction function ..................................................................... 1-86 machine instructions (index by alphabet) ....................................................... 1-91 machine instructions (index by types) ............................................................ 1-130 instruction code table ............................................................................................ 1-146 built-in prom version ...................................................................................................... 1-148 table of contents
rev.1.00 aug 06, 2004 4519 group ii rej09b0175-0100z chapter 2 application 2.1 i/o pins ............................................................................................................................... ..... 2-2 2.1.1 i/o ports .......................................................................................................................... 2-2 2.1.2 related registers ............................................................................................................ 2-6 2.1.3 port application examples ........................................................................................... 2-12 2.1.4 notes on use ................................................................................................................ 2-13 2.2 interrupts ............................................................................................................................... 2-15 2.2.1 interrupt functions ........................................................................................................ 2-15 2.2.2 related registers .......................................................................................................... 2-18 2.2.3 interrupt application examples .................................................................................... 2-21 2.2.4 notes on use ................................................................................................................ 2-30 2.3 timers ............................................................................................................................... ..... 2-31 2.3.1 timer functions ............................................................................................................. 2-31 2.3.2 related registers .......................................................................................................... 2-32 2.3.3 timer application examples ........................................................................................ 2-37 2.3.4 notes on use ................................................................................................................ 2-50 2.4 a/d converter ....................................................................................................................... 2-52 2.4.1 related registers .......................................................................................................... 2-53 2.4.2 a/d converter application examples .......................................................................... 2-54 2.4.3 notes on use ................................................................................................................ 2-56 2.5 serial i/o ............................................................................................................................... . 2-58 2.5.1 serial i/o functions ...................................................................................................... 2-58 2.5.2 related registers .......................................................................................................... 2-59 2.5.3 operation description ................................................................................................... 2-60 2.5.4 serial i/o application example ................................................................................... 2-63 2.5.5 notes on use ................................................................................................................ 2-66 2.6 reset ............................................................................................................................... ........ 2-67 2.6.1 reset circuit .................................................................................................................. 2-67 2.6.2 internal state at reset .................................................................................................. 2-68 2.6.3 notes on use ................................................................................................................ 2-69 2.7 voltage drop detection circuit .......................................................................................... 2-70 2.8 ram back-up ........................................................................................................................ 2-71 2.8.1 ram back-up mode ..................................................................................................... 2-71 2.8.2 related registers .......................................................................................................... 2-74 2.8.3 notes on use ................................................................................................................ 2-78 2.9 oscillation circuit ................................................................................................................ 2-79 2.9.1 oscillation operation .................................................................................................... 2-79 2.9.2 related register ............................................................................................................ 2-80 2.9.3 notes on use ................................................................................................................ 2-81 table of contents
rev.1.00 aug 06, 2004 4519 group iii rej09b0175-0100z chapter 3 appendix 3.1 electrical characteristics ..................................................................................................... 3-2 3.1.1 absolute maximum ratings ............................................................................................ 3-2 3.1.2 recommended operating conditions ............................................................................ 3-3 3.1.3 electrical characteristics ................................................................................................ 3-6 3.1.4 a/d converter recommended operating conditions .................................................... 3-8 3.1.5 voltage drop detection circuit characteristics ........................................................... 3-10 3.1.6 basic timing diagram ................................................................................................... 3-10 3.2 typical characteristics ....................................................................................................... 3-11 3.3 list of precautions .............................................................................................................. 3-12 3.3.1 program counter ........................................................................................................... 3-12 3.3.2 stack registers (sks) ................................................................................................... 3-12 3.3.3 notes on i/o port ......................................................................................................... 3-12 3.3.4 notes on interrupt ........................................................................................................ 3-14 3.3.5 notes on timer .............................................................................................................. 3-15 3.3.6 notes on a/d conversion ............................................................................................ 3-17 3.3.7 notes on serial i/o ...................................................................................................... 3-18 3.3.8 notes on reset .............................................................................................................. 3-19 3.3.9 notes on ram back-up ............................................................................................... 3-19 3.3.10 notes on clock control .............................................................................................. 3-20 3.3.11 electric characteristic differences between mask rom and one time prom version mcu .. 3-20 3.3.12 note on power source voltage ............................................................................... 3-20 3.4 notes on noise ..................................................................................................................... 3-21 3.4.1 shortest wiring length .................................................................................................. 3-21 3.4.2 connection of bypass capacitor across v ss line and v dd line ............................ 3-23 3.4.3 wiring to analog input pins ........................................................................................ 3-24 3.4.4 oscillator concerns ....................................................................................................... 3-24 3.4.5 setup for i/o ports ....................................................................................................... 3-25 3.4.6 providing of watchdog timer function by software .................................................. 3-25 3.5 package outline ................................................................................................................... 3-27 table of contents
rev.1.00 aug 06, 2004 4519 group iv rej09b0175-0100z list of figures chapter 1 hardware fig. 1 amc instruction execution example ............................................................................... 1-17 fig. 2 rar instruction execution example ............................................................................... 1-17 fig. 3 registers a, b and register e ........................................................................................ 1-17 fig. 4 tabp p instruction execution example .......................................................................... 1-17 fig. 5 stack registers (sks) structure ....................................................................................... 1-18 fig. 6 example of operation at subroutine call ....................................................................... 1-18 fig. 7 program counter (pc) structure ..................................................................................... 1-19 fig. 8 data pointer (dp) structure ............................................................................................. 1-19 fig. 9 sd instruction execution example .................................................................................. 1-19 fig. 10 rom map of m34519m8/e8 ......................................................................................... 1-20 fig. 11 page 1 (addresses 0080 16 to 00ff 16 ) structure ....................................................... 1-20 fig. 12 ram map ......................................................................................................................... 1-21 fig. 13 program example of interrupt processing ................................................................... 1-23 fig. 14 internal state when interrupt occurs ............................................................................ 1-23 fig. 15 interrupt system diagram ............................................................................................... 1-23 fig. 16 interrupt sequence .......................................................................................................... 1-25 fig. 17 external interrupt circuit structure ................................................................................ 1-26 fig. 18 external 0 interrupt program example-1 ...................................................................... 1-29 fig. 19 external 0 interrupt program example-2 ...................................................................... 1-29 fig. 20 external 0 interrupt program example-3 ...................................................................... 1-29 fig. 21 external 1 interrupt program example-1 ...................................................................... 1-30 fig. 22 external 1 interrupt program example-2 ...................................................................... 1-30 fig. 23 external 1 interrupt program example-3 ...................................................................... 1-30 fig. 24 auto-reload function ....................................................................................................... 1-31 fig. 25 timer structure (1) ......................................................................................................... 1-33 fig. 26 timer structure (2) ......................................................................................................... 1-34 fig. 27 period measurement circuit program example ........................................................... 1-39 fig. 28 period measurement circuit program example ........................................................... 1-41 fig. 29 timer 4 operation (reload register r4l: 03 16 , r4h: 02 16 ) ................................. 1-42 fig. 30 cntr1 output auto-control function by timer 3 ......................................................... 1-43 fig. 31 timer 4 count start/stop timing .................................................................................... 1-44 fig. 32 watchdog timer function ................................................................................................ 1-45 fig. 33 program example to start/stop watchdog timer ......................................................... 1-46 fig. 34 program example to enter the mode when using the watchdog timer .................. 1-46 fig. 35 a/d conversion circuit structure ................................................................................... 1-47 fig. 36 a/d conversion timing chart .......................................................................................... 1-50 fig. 37 setting registers .............................................................................................................. 1-50 fig. 38 comparator operation timing chart ............................................................................... 1-51 fig. 39 definition of a/d conversion accuracy ........................................................................ 1-52 fig. 40 serial i/o structure ......................................................................................................... 1-53 fig. 41 serial i/o register state when transferring .................................................................. 1-54 fig. 42 serial i/o connection example ...................................................................................... 1-55 fig. 43 timing of serial i/o data transfer ................................................................................. 1-56 fig. 44 reset release timing ...................................................................................................... 1-58 ____________ fig. 45 reset pin input waveform and reset operation ....................................................... 1-58 fig. 46 structure of reset pin and its peripherals, and power-on reset operation ............. 1-59 fig. 47 internal state at reset 1 ................................................................................................. 1-60 list of figures
rev.1.00 aug 06, 2004 4519 group v rej09b0175-0100z list of figures fig. 48 internal state at reset 2 ................................................................................................. 1-61 fig. 49 voltage drop detection reset circuit ............................................................................. 1-62 fig. 50 voltage drop detection circuit operation waveform .................................................... 1-62 fig. 51 state transition ................................................................................................................ 1-65 fig. 52 set source and clear source of the p flag ................................................................. 1-65 fig. 53 start condition identified example using the snzp instruction ................................ 1-65 fig. 54 clock control circuit structure ....................................................................................... 1-68 fig. 55 switch to ceramic resonance/rc oscillation/quartz-crystal oscillation .................... 1-69 fig. 56 handling of x in and x out when operating on-chip oscillator .................................. 1-70 fig. 57 ceramic resonator external circuit ............................................................................... 1-70 fig. 58 external rc oscillation circuit ....................................................................................... 1-70 fig. 59 external quartz-crystal circuit ........................................................................................ 1-70 fig. 60 external clock input circuit ............................................................................................ 1-70 fig. 61 period measurement circuit program example ........................................................... 1-73 fig. 62 external 0 interrupt program example-1 ...................................................................... 1-74 fig. 63 external 0 interrupt program example-2 ...................................................................... 1-74 fig. 64 external 0 interrupt program example-3 ...................................................................... 1-74 fig. 65 external 1 interrupt program example-1 ...................................................................... 1-75 fig. 66 external 1 interrupt program example-2 ...................................................................... 1-75 fig. 67 external 1 interrupt program example-3 ...................................................................... 1-75 fig. 68 a/d converter program example-3 ............................................................................... 1-76 fig. 69 analog input external circuit example-1 ...................................................................... 1-76 fig. 70 analog input external circuit example-2 ...................................................................... 1-76 fig. 71 pin configuration of built-in prom version .............................................................. 1-148 fig. 72 prom memory map ..................................................................................................... 1-149 fig. 73 flow of writing and test of the product shipped in blank ....................................... 1-149 chapter 2 application fig. 2.1.1 key input by key scan ............................................................................................... 2-12 fig. 2.1.2 key scan input timing ................................................................................................ 2-12 fig. 2.2.1 external 0 interrupt operation example ................................................................... 2-22 fig. 2.2.2 external 0 interrupt setting example ....................................................................... 2-23 fig. 2.2.3 external 1 interrupt operation example ................................................................... 2-24 fig. 2.2.4 external 1 interrupt setting example ....................................................................... 2-25 fig. 2.2.5 timer 1 constant period interrupt setting example ................................................ 2-26 fig. 2.2.6 timer 2 constant period interrupt setting example ................................................ 2-27 fig. 2.2.7 timer 3 constant period interrupt setting example ................................................ 2-28 fig. 2.2.8 timer 4 constant period interrupt setting example ................................................ 2-29 fig. 2.3.1 peripheral circuit example ......................................................................................... 2-37 fig. 2.3.2 timer 4 operation ....................................................................................................... 2-38 fig. 2.3.3 watchdog timer function ............................................................................................ 2-39 fig. 2.3.4 constant period measurement setting example ..................................................... 2-40 fig. 2.3.5 cntr0 output setting example ................................................................................ 2-41 fig. 2.3.6 cntr0 input setting example .................................................................................. 2-42 fig. 2.3.7 timer start by external input setting example ....................................................... 2-43 fig. 2.3.8 pwm output control setting example ...................................................................... 2-44 fig. 2.3.9 period measurement of cntr0 pin input setting example (1) ........................... 2-45 fig. 2.3.10 period measurement of cntr0 pin input setting example (2) ......................... 2-46 fig. 2.3.11 pulse width measurement of int0 pin input setting example (1) ..................... 2-47 fig. 2.3.12 pulse width measurement of int0 pin input setting example (2) ..................... 2-48 fig. 2.3.13 watchdog timer setting example ............................................................................ 2-49 fig. 2.3.14 period measurement circuit program example ..................................................... 2-51
rev.1.00 aug 06, 2004 4519 group vi rej09b0175-0100z list of figures fig. 2.3.15 count start time and count time when operation starts (ps, t1, t2 and t3) 2-51 fig. 2.3.16 count start time and count time when operation starts (t4) ............................ 2-51 fig. 2.4.1 a/d converter structure ............................................................................................. 2-52 fig. 2.4.2 a/d conversion mode setting example .................................................................... 2-55 fig. 2.4.3 analog input external circuit example-1 .................................................................. 2-56 fig. 2.4.4 analog input external circuit example-2 .................................................................. 2-56 fig. 2.4.5 a/d converter operating mode program example .................................................. 2-56 fig. 2.5.1 serial i/o block diagram ........................................................................................... 2-58 fig. 2.5.2 serial i/o connection example ................................................................................. 2-60 fig. 2.5.3 serial i/o register state when transfer .................................................................... 2-60 fig. 2.5.4 serial i/o transfer timing ........................................................................................... 2-61 fig. 2.5.5 setting example when a serial i/o of master side is not used .......................... 2-64 fig. 2.5.6 setting example when a serial i/o interrupt of slave side is used .................... 2-65 fig. 2.6.1 structure of reset pin and its peripherals, and power-on reset operation ......... 2-67 fig. 2.6.2 oscillation stabilizing time after system is released from reset .......................... 2-67 fig. 2.6.3 internal state at reset ................................................................................................ 2-68 fig. 2.6.4 internal state at reset ................................................................................................ 2-69 fig. 2.7.1 voltage drop detection circuit ................................................................................... 2-70 fig. 2.7.2 voltage drop detection circuit operation waveform example ............................... 2-70 fig. 2.8.1 state transition ............................................................................................................ 2-71 fig. 2.8.2 start condition identified example ............................................................................ 2-73 fig. 2.9.1 structure of clock control circuit .............................................................................. 2-79
rev.1.00 aug 06, 2004 4519 group vii rej09b0175-0100z chapter 3 appendix fig. 3.3.1 period measurement circuit program example ....................................................... 3-16 fig. 3.3.2 count start time and count time when operation starts (ps, t1, t2 and t3) .. 3-16 fig. 3.3.3 count start time and count time when operation starts (t4) .............................. 3-16 fig. 3.3.4 analog input external circuit example-1 .................................................................. 3-17 fig. 3.3.5 analog input external circuit example-2 .................................................................. 3-17 fig. 3.3.6 a/d converter operating mode program example .................................................. 3-17 fig. 3.4.1 selection of packages ............................................................................................... 3-21 ____________ fig. 3.4.2 wiring for the reset input pin ............................................................................... 3-21 fig. 3.4.3 wiring for clock i/o pins ........................................................................................... 3-22 fig. 3.4.4 wiring for cnv ss pin ................................................................................................. 3-22 fig. 3.4.5 wiring for the v pp pin of the built-in prom version ............................................ 3-23 fig. 3.4.6 bypass capacitor across the v ss line and the v dd line ...................................... 3-23 fig. 3.4.7 analog signal line and a resistor and a capacitor ................................................ 3-24 fig. 3.4.8 wiring for a large current signal line ...................................................................... 3-24 fig. 3.4.9 wiring to a signal line where potential levels change frequently ....................... 3-25 fig. 3.4.10 v ss pattern on the underside of an oscillator ..................................................... 3-25 fig. 3.4.11 watchdog timer by software ................................................................................... 3-26 list of figures
rev.1.00 aug 06, 2004 4519 group viii rej09b0175-0100z list of tables chapter 1 hardware table selection of system clock .................................................................................................. 1-6 table 1 rom size and pages .................................................................................................... 1-20 table 2 ram size ........................................................................................................................ 1-21 table 3 interrupt sources ............................................................................................................ 1-22 table 4 interrupt request flag, interrupt enable bit and skip instruction .............................. 1-22 table 5 interrupt enable bit function ......................................................................................... 1-22 table 6 interrupt control registers ............................................................................................. 1-24 table 7 external interrupt activated conditions ........................................................................ 1-26 table 8 external interrupt control register ................................................................................ 1-28 table 9 function related timers ................................................................................................. 1-32 table 10 timer related registers ................................................................................................ 1-35 table 11 a/d converter characteristics ..................................................................................... 1-47 table 12 a/d control registers ................................................................................................... 1-48 table 13 change of successive comparison register ad during a/d conversion .............. 1-49 table 14 serial i/o pins .............................................................................................................. 1-53 table 15 serial i/o control register ........................................................................................... 1-53 table 16 processing sequence of data transfer from master to slave ................................ 1-57 table 17 port state at reset ....................................................................................................... 1-59 table 18 voltage drop detection circuit operation state ......................................................... 1-62 table 19 functions and states retained at ram back-up ..................................................... 1-63 table 20 return source and return condition .......................................................................... 1-64 table 21 key-on wakeup control register, pull-up control register ....................................... 1-66 table 22 key-on wakeup control register, pull-up control register ....................................... 1-67 table 23 clock control registers ................................................................................................ 1-71 table 24 product of built-in prom version ........................................................................... 1-148 table 25 programming adapter ................................................................................................ 1-149 chapter 2 application table 2.1.1 timer control register w4 ........................................................................................ 2-6 table 2.1.2 timer control register w6 ........................................................................................ 2-6 table 2.1.3 serial i/o control register j1 ................................................................................... 2-7 table 2.1.4 a/d control register q2 ............................................................................................ 2-7 table 2.1.5 pull-up control register pu0 .................................................................................... 2-8 table 2.1.6 pull-up control register pu1 .................................................................................... 2-8 table 2.1.7 port output structure control register fr0 ............................................................. 2-9 table 2.1.8 port output structure control register fr1 ............................................................. 2-9 table 2.1.9 port output structure control register fr2 ........................................................... 2-10 table 2.1.10 port output structure control register fr3 ......................................................... 2-10 table 2.1.11 key-on wakeup control register k0 .................................................................... 2-11 table 2.1.12 key-on wakeup control register k2 .................................................................... 2-11 table 2.1.13 connections of unused pins ................................................................................ 2-14 table 2.2.1 interrupt control register v1 ................................................................................... 2-18 table 2.2.2 interrupt control register v2 ................................................................................... 2-19 table 2.2.3 interrupt control register i1 .................................................................................... 2-19 table 2.2.4 interrupt control register i2 .................................................................................... 2-20 table 2.3.1 interrupt control register v1 ................................................................................... 2-32 table 2.3.2 interrupt control register v2 ................................................................................... 2-32 list of tables
rev.1.00 aug 06, 2004 4519 group ix rej09b0175-0100z list of tables table 2.3.3 interrupt control register i1 .................................................................................... 2-33 table 2.3.4 interrupt control register i2 .................................................................................... 2-33 table 2.3.5 timer control register pa ....................................................................................... 2-34 table 2.3.6 timer control register w1 ...................................................................................... 2-34 table 2.3.7 timer control register w2 ...................................................................................... 2-34 table 2.3.8 timer control register w3 ...................................................................................... 2-35 table 2.3.9 timer control register w4 ...................................................................................... 2-35 table 2.3.10 timer control register w5 .................................................................................... 2-36 table 2.3.11 timer control register w6 .................................................................................... 2-36 table 2.4.1 interrupt control register v2 ................................................................................... 2-53 table 2.4.2 a/d control register q1 .......................................................................................... 2-53 table 2.4.3 a/d control register q2 .......................................................................................... 2-54 table 2.4.4 a/d control register q3 .......................................................................................... 2-54 table 2.5.1 interrupt control register v2 ................................................................................... 2-59 table 2.5.2 serial i/o mode register j1 ................................................................................... 2-59 table 2.7.1 voltage drop detection circuit operation state .................................................... 2-70 table 2.8.1 functions and states retained at ram back-up mode ...................................... 2-72 table 2.8.2 return source and return condition ...................................................................... 2-73 table 2.8.3 start condition identification ................................................................................... 2-73 table 2.8.4 interrupt control register i1 .................................................................................... 2-74 table 2.8.5 interrupt control register i2 .................................................................................... 2-74 table 2.8.6 pull-up control register pu0 .................................................................................. 2-75 table 2.8.7 pull-up control register pu1 .................................................................................. 2-76 table 2.8.8 key-on wakeup control register k0 ...................................................................... 2-76 table 2.8.9 key-on wakeup control register k1 ...................................................................... 2-77 table 2.8.10 key-on wakeup control register k2 .................................................................... 2-77 table 2.9.1 clock control register mr ...................................................................................... 2-80 table 2.9.2 clock control register rg ...................................................................................... 2-80 chapter 3 appendix table 3.1.1 absolute maximum ratings ....................................................................................... 3-2 table 3.1.2 recommended operating conditions 1 ................................................................... 3-3 table 3.1.3 recommended operating conditions 2 ................................................................... 3-4 table 3.1.4 recommended operating conditions 3 ................................................................... 3-5 table 3.1.5 electrical characteristics 1 ....................................................................................... 3-6 table 3.1.6 electrical characteristics 2 ....................................................................................... 3-7 table 3.1.7 a/d converter recommended operating conditions ............................................... 3-8 table 3.1.8 a/d converter characteristics ................................................................................... 3-9 table 3.1.9 voltage drop detection circuit characteristics ...................................................... 3-10 table 3.3.1 connections of unused pins .................................................................................. 3-13
chapter 1 hardware description features application pin configuration block diagram performance overview pin description function block operations rom ordering method list of precautions control registers instructions built-in prom version
1-2 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z description the 4519 group is a 4-bit single-chip microcomputer designed with cmos technology. its cpu is that of the 4500 series using a simple, high-speed instruction set. the computer is equipped with serial i/o, four 8-bit timers (each timer has one or two reload regis- ters), a 10-bit a/d converter, interrupts, and oscillation circuit switch function. the various microcomputers in the 4519 group include variations of the built-in memory size as shown in the table below. features minimum instruction execution time .................................. 0.5 s (at 6 mhz oscillation frequency, in x in through-mode) supply voltage mask rom version ...................................................... 1.8 to 5.5 v one time prom version ............................................. 2.5 to 5.5 v (it depends on operation source clock, oscillation frequency and op- eration mode) timers timer 1 ...................................... 8-bit timer with a reload register timer 2 ...................................... 8-bit timer with a reload register timer 3 ...................................... 8-bit timer with a reload register timer 3 ................................. 8-bit timer with two reload registers part number M34519M6-XXXFP m34519m8-xxxfp m34519e8fp ( note ) rom type mask rom mask rom one time prom package 42p2r-a 42p2r-a 42p2r-a ram size ( ? 4 bits) 384 words 384 words 384 words rom (prom) size ( ? 10 bits) 6144 words 8192 words 8192 words interrupt ........................................................................ 8 sources key-on wakeup function pins ................................................... 10 serial i/o ....................................................................... 8 bits ? 1 a/d converter .......... 10-bit successive comparison method, 8ch voltage drop detection circuit reset occurrence .................................... typ. 3.5 v (ta = 25 ?) reset release .......................................... typ. 3.7 v (ta = 25 ?) watchdog timer clock generating circuit (ceramic resonator/rc oscillation/quartz-crystal oscillation/on- chip oscillator) led drive directly enabled (port d) application electrical household appliance, consumer electronic products, of- fice automation equipment, etc. note: shipped in blank. description/features/application/pin configuration pin configuration pin configuration (top view) (4519 group) outline 42p2r-a m34519mx-xxxfp m34519e8fp 8 7 10 9 12 11 14 15 16 13 17 19 20 21 18 6 5 4 3 2 1 35 36 33 34 31 32 29 28 27 30 26 24 23 22 25 37 38 39 40 41 42 p1 2 p1 1 p1 0 p0 3 p0 2 p0 1 p0 0 p4 3 /a in7 p4 2 /a in6 p4 1 /a in5 p4 0 /a in4 p6 3 /a in3 p6 2 /a in2 p6 1 /a in1 p6 0 /a in0 p3 3 p3 2 p3 1 /int1 p3 0 /int0 vdce v dd p1 3 d 0 d 1 d 2 d 3 d 4 d 5 d 6 /cntr 0 d 7 /cntr 1 p5 0 p5 1 p5 2 p5 3 p2 0 /s ck p2 1 /s out p2 2 /s in reset cnv ss x out x in v ss
1-3 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z block diagram (4519 group) 4 4 3 4 4 8 ram rom memory i/o port internal peripheral functions timer timer 1(8 bits) system clock generation circuit timer 2(8 bits) 384 words ? ? ? ?
1-4 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z performance overview function 153 0.5 ? ? ? p4 3 are also used as a in4 a in7 , respectively. 4-bit i/o port ; the output structure is switched by software. 4-bit i/o port ; ports p6 0 p6 3 are also used as a in0 a in3 , respectively. 8-bit timer with a reload register is also used as an event counter. also, this is equipped with a period/pulse width measurement function. 8-bit timer with a reload register. 8-bit timer with a reload register is also used as an event counter. 8-bit timer with two reload registers and pwm output function. 10-bit wide ? ? 20 c to 85 c 1.8 v to 5.5 v (it depends on operation source clock, oscillation frequency and operating mode.) 2.5 v to 5.5 v (it depends on operation source clock, oscillation frequency and operating mode.) 2.8 ma (ta=25 c, v dd =5v, f(x in )=6 mhz, f(stck)=f(x in ), on-chip oscillator stop) 70 c, v dd =5v, f(x in )=32 khz, f(stck)=f(x in ), on-chip oscillator stop) 150 c, v dd =5v, on-chip oscillator is used, f(stck)=f(ring), f(x in ) stop) 0.1 c, v dd = 5 v, output transistors in the cut-off state) parameter number of basic instructions minimum instruction execution time memory sizes input/output ports timers a/d converter serial i/o interrupt subroutine nesting device structure package operating temperature range supply voltage power dissipation (typical value) rom ram d 0 d 7 p0 0 p0 3 p1 0 p1 3 p2 0 p2 2 p3 0 p3 3 p4 0 p4 3 p5 0 p5 3 p6 0 p6 3 timer 1 timer 2 timer 3 timer 4 sources nesting mask rom version one time prom version active mode ram back-up mode i/o (input is examined by skip decision) i/o i/o i/o i/o i/o i/o i/o m34519m6 m34519m8/e8 m34519m6/m8/e8 performance overview
1-5 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z pin description name power supply ground cnv ss voltage drop detection circuit enable reset input/output main clock input pin v dd v ss cnv ss vdce reset x in input/output input i/o input function connected to a plus power supply. connected to a 0 v power supply. connect cnv ss to v ss and apply l (0v) to cnv ss certainly. this pin is used to operate/stop the voltage drop detection circuit. when h level is input to this pin, the circuit starts operating. when l level is input to this pin, the circuit stops operating. an n-channel open-drain i/o pin for a system reset. when the srst instruction, watchdog timer, the built-in power-on reset or the voltage drop detection circuit causes the system to be reset, the reset pin outputs l level. i/o pins of the main clock generating circuit. when using a ceramic resonator, connect it between pins x in and x out . when using a 32 khz quartz-crystal oscillator, connect it between pins x in and x out . a feedback resistor is built-in between them. when using the rc oscillation, connect a resistor and a capacitor to x in , and leave x out pin open. x out main clock output output d 0 d 7 p0 0 p0 3 p1 0 p1 3 p2 0 p2 3 p3 0 p3 3 p4 0 p4 3 p5 0 p5 3 p6 0 p6 3 cntr0, cntr1 int0, int1 a in0 a in7 s ck s out s in i/o port d input is examined by skip decision. i/o port p0 i/o port p1 i/o port p2 i/o port p3 i/o port p4 i/o port p5 i/o port p6 timer input/output interrupt input analog input serial i/o data i/o serial i/o data output serial i/o clock input i/o i/o i/o i/o i/o i/o i/o i/o i/o input input i/o output input each pin of port d has an independent 1-bit wide i/o function. the output structure can be switched to n-channel open-drain or cmos by software. for input use, set the latch of the specified bit to 1 and select the n-channel open-drain. ports d 6 , d 7 is also used as cntr0 pin and cntr1 pin, respectively. p ort p0 serves as a 4-bit i/o port. the output structure can be switched to n-channel open-drain or cmos by software. for input use, set the latch of the specified bit to 1 and select the n-channel open-drain. port p0 has a key-on wakeup function and a pull-up function. both functions can be switched by software. p ort p1 serves as a 4-bit i/o port. the output structure can be switched to n-channel open-drain or cmos by software. for input use, set the latch of the specified bit to 1 and select the n-channel open-drain. port p1 has a key-on wakeup function and a pull-up function. both functions can be switched by software. p ort p2 serves as a 3-bit i/o port. the output structure is n-channel open-drain. for input use, set the latch of the specified bit to 1 . ports p2 0 p2 2 are also used as s ck , s out , s in , respectively. p ort p3 serves as a 4-bit i/o port. the output structure is n-channel open-drain. for input use, set the latch of the specified bit to 1 . ports p3 0 and p3 1 are also used as int0 pin and int1 pin, respectively. p ort p4 serves as a 4-bit i/o port. the output structure can be switched to n-channel open-drain. for input use, set the latch of the specified bit to 1 . ports p4 0 p4 3 are also used as a in4 a in7 , respectively. p ort p5 serves as a 4-bit i/o port. the output structure can be switched to n-channel open-drain or cmos by software. for input use, set the latch of the specified bit to 1 and select the n-channel open-drain. p ort p6 serves as a 4-bit i/o port. the output structure can be switched to n-channel open-drain. for input use, set the latch of the specified bit to 1 . ports p6 0 p6 3 are also used as a in0 a in3 , respectively. cntr0 pin has the function to input the clock for the timer 1 event counter, and to output the timer 1 or timer 2 underflow signal divided by 2. cntr1 pin has the function to input the clock for the timer 3 event counter, and to output the pwm signal generated by timer 4.cntr0 pin and cntr1 pin are also used as ports d 6 and d 7 , respectively. int0 pin and int1 pin accept external interrupts. they have the key-on wakeup func- tion which can be switched by software. int0 pin and int1 pin are also used as ports p3 0 and p3 1 , respectively. a/d converter analog input pins. a in0 a in7 are also used as ports p6 0 p6 3 and p4 0 p4 3 , respectively. serial i/o data transfer synchronous clock i/o pin. s ck pin is also used as port p2 0. . serial i/o data output pin. s out pin is also used as port p2 1 . serial i/o data input pin. s in pin is also used as port p2 2 . pin description
1-6 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z definition of clock and cycle clock (f(x in )) by the external ceramic resonator clock (f(x in )) by the external rc oscillation clock (f(x in )) by the external input clock (f(ring)) of the on-chip oscillator which is the internal oscillator clock (f(x in )) by the external quartz-crystal oscillation register mr system clock f(stck) = f(x in ) f(stck) = f(ring) f(stck) = f(x in )/2 f(stck) = f(ring)/2 f(stck) = f(x in )/4 f(stck) = f(ring)/4 f(stck) = f(x in )/8 f(stck) = f(ring)/8 table selection of system clock ? note: the f(ring)/8 is selected after system is released from reset. when on-chip oscillator clock is selected for main clock, set the on-chip oscillator to be operating state. mr 2 0 1 0 1 mr 3 0 0 1 1 operation mode x in through mode on-chip oscillator through mode x in divided by 2 mode on-chip oscillator divided by 2 mode x in divided by 4 mode on-chip oscillator divided by 4 mode x in divided by 8 mode on-chip oscillator divided by 8 mode ? ? ? ? p2 2 can be used even when s in , s out and s ck are selected. 4: the input/output of d 6 can be used even when cntr0 (input) is selected. 5: the input of d 6 can be used even when cntr0 (output) is selected. 6: the input/output of d 7 can be used even when cntr1 (input) is selected. 7: the input of d 7 can be used even when cntr1 (output) is selected. pin d 6 d 7 p2 0 p2 1 p2 2 p3 0 p3 1 multifunction cntr0 cntr1 s ck s out s in int0 int1 multifunction pin cntr0 cntr1 s ck s out s in int0 int1 multifunction d 6 d 7 p2 0 p2 1 p2 2 p3 0 p3 1 pin p6 0 p6 1 p6 2 p6 3 p4 0 p4 1 p4 2 p4 3 multifunction a in0 a in1 a in2 a in3 a in4 a in5 a in6 a in7 pin a in0 a in1 a in2 a in3 a in4 a in5 a in6 a in7 multifunction p6 0 p6 1 p6 2 p6 3 p4 0 p4 1 p4 2 p4 3 multifunction/definition of clock and cycle
1-7 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z port function port port d port p0 port p1 port p2 port p3 port p4 port p5 port p6 i/o unit 1 4 4 3 4 4 4 4 control instructions sd, rd szd cld op0a iap0 op1a iap1 op2a iap2 op3a iap3 op4a iap4 op5a iap5 op6a iap6 control registers fr1, fr2 w6 w4 fr0 pu0 k0, k1 fr0 pu1 k0 j1 i1, i2 k2 q1 q2 fr3 q2 q1 output structure n-channel open-drain/ cmos n-channel open-drain/ cmos n-channel open-drain/ cmos n-channel open-drain n-channel open-drain n-channel open-drain n-channel open-drain/ cmos n-channel open-drain input output i/o (8) i/o (4) i/o (4) i/o (3) i/o (4) i/o (4) i/o (4) i/o (4) remark pin d 0 d 5 d 6 /cntr0 d 7 /cntr1 p0 0 p0 3 p1 0 p1 3 p2 0 /s ck , p2 1 /s out p2 2 /s in p3 0 /int0, p3 1 /int1 p3 2 , p3 3 p4 0 /a in4 p4 3 / ain7 p5 0 p5 3 p6 0 /a in0 p6 3 /a in3 output structure selection function (programmable) built-in programmable pull-up functions, key-on wakeup functions and output structure selection functions built-in programmable pull-up functions, key-on wakeup functions and output structure selection functions output structure selection function (programmable) port function
1-8 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z connections of unused pins connection open. open. open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. pin x in x out d 0 d 5 d 6 /cntr0 d 7 /cntr1 p0 0 p0 3 p1 0 p1 3 p2 0 /s ck p2 1 /s out p2 2 /s in p3 0 /int0 p3 1 /int1 p3 2 , p3 3 p4 0 /a in4 p4 3 /a in7 p5 0 p5 3 p6 0 /a in0 p6 3 /a in3 usage condition internal oscillator is selected. (note 1) internal oscillator is selected. (note 1) rc oscillator is selected. (note 2) external clock input is selected for main clock. (note 3) n-channel open-drain is selected for the output structure. (note 4) cntr0 input is not selected for timer 1 count source. n-channel open-drain is selected for the output structure. (note 4) cntr1 input is not selected for timer 3 count source. n-channel open-drain is selected for the output structure. (note 4) the key-on wakeup function is not selected. (note 6) n-channel open-drain is selected for the output structure. (note 5) the pull-up function is not selected. (note 4) the key-on wakeup function is not selected. (note 6) the key-on wakeup function is not selected. (note 7) n-channel open-drain is selected for the output structure. (note 5) the pull-up function is not selected. (note 4) the key-on wakeup function is not selected. (note 7) s ck pin is not selected. s in pin is not selected. 0 is set to output latch. 0 is set to output latch. n-channel open-drain is selected for the output structure. notes 1: after system is released from reset, the internal oscillation (on-chip oscillator) is selected for system clock (rg 0 =0, mr 0 =1). 2: when the crck instruction is executed, the rc oscillation circuit becomes valid. be careful that the swich of system clock is n ot executed at oscilla- tion start only by the crck instruction execution. in order to start oscillation, setting the main clock f(x in ) oscillation to be valid (mr 1 =0) is required. (if necessary, generate the oscillation stabilizing wait time by software.) also, when the main clock (f(x in )) is selected as system clock, set the main clock f(x in ) oscillation (mr 1 =0) to be valid, and select main clock f(x in ) (mr 0 =0). be careful that the switch of system clock cannot be executed at the same time when main clock oscillation is started. 3: in order to use the external clock input for the main clock, select the ceramic resonance by executing the cmck instruction at the beggining of soft- ware, and then set the main clock (f(x in )) oscillation to be valid (mr 1 =0). until the main clock (f(x in )) oscillation becomes valid (mr 1 =0) after ceramic resonance becomes valid, x in pin is fixed to h . when an external clock is used, insert a 1 k ? d 5 and the pull-up function of p0 0 p0 3 and p1 0 p1 3 with every one port. set the corresponding bits of registers for each port. 5: be sure to select the output structure of ports p0 0 p0 3 and p1 0 p1 3 with every two ports. if only one of the two pins is used, leave another one open. 6: the key-on wakeup function is selected with every two bits. when only one of key-on wakeup function is used, considering tha t the value of key-on wake-up control register k1, set the unused 1-bit to h input (turn pull-up transistor on and open) or l input (connect to v ss , or open and set the output latch to 0 ). 7: the key-on wakeup function is selected with every two bits. when one of key-on wakeup function is used, turn pull-up transis tor of unused one on and open. (note when connecting to v ss and v dd )
1-9 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z port block diagrams port block diagram (1) d 0 d 3 s rq fr1 i t h i s s y m b o l r e p r e s e n t s a p a r a s i t i c d i o d e o n t h e p o r t . 2 : a p p l i e d p o t e n t i a l t o t h e s e p o r t s m u s t b e v d d o r l e s s . 3 : i r e p r e s e n t s b i t s 0 t o 3 . n o t e s 1 : r e g i s t e r y decoder s d i n s t r u c t i o n rd instruction skip decision c l d i n s t r u c t i o n (note 1) ( n o t e 2 ) (note 1) ( n o t e 3 ) szd instruction d 4 s rq fr2 0 r e g i s t e r y decoder s d i n s t r u c t i o n rd instruction skip decision c l d i n s t r u c t i o n (note 1) (note 2) (note 1) szd instruction d 5 s rq fr2 1 r e g i s t e r y decoder s d i n s t r u c t i o n rd instruction skip decision cld instruction (note 1) (note 2) (note 1) szd instruction port block diagram
1-10 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z port block diagram (2) this symbol represents a parasitic diode on the port. 2: applied potential to these ports must be v dd or less. notes 1: w1 0 w1 1 s rq fr2 2 w6 0 0 1 d 6 /cntr0 register y decoder sd instruction rd instruction skip decision cld instruction (note 1) (note 2) timer 1 underflow signal w2 3 0 1 1/2 1/2 timer 2 underflow signal w6 2 0 1 clock (input) for timer 1 event count or period measurement signal input w5 0 w5 1 w3 0 w3 1 s rq fr2 3 w4 3 0 1 d 7 /cntr1 register y decoder sd instruction rd instruction skip decision cld instruction (note 1) (note 2) w6 3 0 1 clock (input) for timer 3 event count pwmod szd instruction szd instruction port block diagram
1-11 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z p0 0 , p0 1 op0a instruction register a a j a j d (note 2) (note 1) fr0 0 iap0 instruction pu0 j pull-up transistor tq this symbol represents a parasitic diode on the port. 2: applied potential to these ports must be v dd or less. 3: j represents bits 0 and 1. 4: k represents bits 2 and 3. notes 1: (note 1) k0 0 key-on wakeup level detection circuit edge detection circuit 0 1 k1 1 0 1 k1 0 (note 3) p0 2 , p0 3 op0a instruction register a a k a k d (note 2) (note 1) fr0 1 iap0 instruction pu0 k pull-up transistor tq (note 1) k0 1 key-on wakeup level detection circuit edge detection circuit 0 1 k1 3 0 1 k1 2 (note 4) p1 0 , p1 1 op1a instruction register a a j a j d (note 2) (note 1) fr0 2 iap1 instruction pu1 j pull-up transistor tq (note 1) k0 2 (note 3) p1 2 , p1 3 op1a instruction register a a k a k d (note 2) (note 1) fr0 3 iap1 instruction pu1 k pull-up transistor tq (note 1) k0 3 key-on wakeup level detection circuit (note 4) (note 3) (note 4) (note 3) (note 4) key-on wakeup level detection circuit port block diagram (3) port block diagram
1-12 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z port block diagram (4) j 1 0 0 1 this symbol represents a parasitic diode on the port. 2: applied potential to these ports must be v dd or less. notes 1: p 2 0 / s c k s y n c h r o n o u s c l o c k ( o u t p u t ) f o r s e r i a l d a t a t r a n s f e r (note 1) ( n o t e 2 ) s y n c h r o n o u s c l o c k ( i n p u t ) f o r s e r i a l d a t a t r a n s f e r r e g i s t e r a a 0 a 0 iap2 instruction j1 0 j1 1 j1 2 j1 3 d t q op2a instruction p 2 1 / s o u t (note 1) (note 2) r e g i s t e r a a 1 a 1 iap2 instruction o p2 a i n s t r u c t i o n d t q s e r i a l d a t a o u t p u t p 2 2 / s i n (note 1) (note 2) register a a 2 a 2 iap2 instruction o p2 a i n s t r u c t i o n d t q s e r i a l d a t a i n p u t j1 1 port block diagram
1-13 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z port block diagram (5) this symbol represents a parasitic diode on the port. 2: applied potential to these ports must be v dd or less. 3: as for details, refer to the external interrupt circuit structure. notes 1: p3 2 (note 1) (note 2) register a a 2 a 2 iap3 instruction op3a instruction d t q p3 0 /int0 (note 1) (note 2) register a a 0 a 0 iap3 instruction op3a instruction d t q external 0 interrupt circuit external 0 interrupt key-on wakeup input timer 1 count start synchronous circuit input period measurement circuit input p3 1 /int1 (note 1) (note 2) register a a 1 a 1 iap3 instruction op3a instruction d t q external 1 interrupt circuit external 1 interrupt key-on wakeup input timer 3 count start synchronous circuit input p3 3 (note 1) (note 2) register a a 3 a 3 iap3 instruction op3a instruction d t q (note 3) (note 3) port block diagram
1-14 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z port block diagram (6) p4 0/ a in4 p4 3/ a in7 decoder op4a instruction register a a i a i d analog input t q iap4 instruction q2 3 q1 (note 3) (note 1) (note 2) this symbol represents a parasitic diode on the port. 2: applied potential to these ports must be v dd or less. 3: i represents bits 0 to 3. notes 1: p5 0 p5 3 register a a i op5a instruction a i d t q iap5 instruction fr3 i (note 3) (note 1) (note 2) (note 3) port block diagram
1-15 4519 group hardware rev.1.00 aug 06, 2004 rej09b0175-0100z port block diagram (7) p 6 0 / a i n 0 , p 6 1/ a i n 1 decoder o p 6 a i n s t r u c t i o n r e g i s t e r a a j a j d a n a l o g i n p u t t q i a p 6 i n s t r u c t i o n q 2 j q 1 ( n o t e 3 ) ( n o t e 1 ) ( n o t e 2 ) t h i s s y m b o l r e p r e s e n t s a p a r a s i t i c d i o d e o n t h e p o r t . 2 : a p p l i e d p o t e n t i a l t o t h e s e p o r t s m u s t b e v d d o r l e s s . 3 : j r e p r e s e n t s b i t s 0 a n d 1 . 4 : k r e p r e s e n t s b i t s 2 a n d 3 . n o t e s 1 : p6 2/ a in2 , p6 3/ a in3 decoder op6a instruction r e g i s t e r a a k a k d a n a l o g i n p u t t q i a p 6 i n s t r u c t i o n q 2 2 q 1 ( n o t e 4 ) ( n o t e 1 ) (note 2) ( n o t e 3 ) port block diagram
1-16 rev.1.00 aug 06, 2004 4519 group hardware rej09b0175-0100z port block diagram (8) rising falling one-sided edge detection circuit key-on wakeup external 1 interrupt timer 3 count start synchronous circuit level detection circuit edge detection circuit skip decision (snzi1 instruction) both edges detection circuit 0 1 i2 2 0 1 exf1 i2 1 p3 1 /int1 k2 2 i2 3 0 1 k2 3 rising 0 1 falling i1 2 one-sided edge detection circuit key-on wakeup 0 1 exf0 external 0 interrupt i1 1 p3 0 /int0 k2 0 timer 1 count start synchronous circuit i1 3 (note 1) level detection circuit edge detection circuit 0 1 k2 1 skip decision (snzi0 instruction) both edges detection circuit this symbol represents a parasitic diode on the port. notes 1: (note 2) (note 3) (note 1) (note 2) (note 3) 2: i1 2 (i2 2 ) = 0: l level detected i1 2 (i2 2 ) = 1: h level detected 3: i1 2 (i2 2 ) = 0: falling edge detected i1 2 (i2 2 ) = 1: rising edge detected period measurement circuit input port block diagram
function block operations 4519 group hardware 1-17 rev.1.00 aug 06, 2004 rej09b0175-0100z function block operations cpu (1) arithmetic logic unit (alu) the arithmetic logic unit alu performs 4-bit arithmetic such as 4- bit data addition, comparison, and operation, or operation, and bit manipulation. (2) register a and carry flag register a is a 4-bit register used for arithmetic, transfer, ex- change, and i/o operation. carry flag cy is a 1-bit flag that is set to 1 when there is a carry with the amc instruction (figure 1). it is unchanged with both a n instruction and am instruction. the value of a 0 is stored in carry flag cy with the rar instruction (fig- ure 2). carry flag cy can be set to 1 with the sc instruction and cleared to 0 with the rc instruction. (3) registers b and e register b is a 4-bit register used for temporary storage of 4-bit data, and for 8-bit data transfer together with register a. register e is an 8-bit register. it can be used for 8-bit data transfer with register b used as the high-order 4 bits and register a as the low-order 4 bits (figure 3). register e is undefined after system is released from reset and re- turned from the ram back-up. accordingly, set the initial value. (4) register d register d is a 3-bit register. it is used to store a 7-bit rom address together with register a and is used as a pointer within the specified page when the tabp p, bla p, or bmla p instruction is executed. also, when the tabp p instruction is executed, the high-order 2 bits of the reference data in rom is stored to the low-order 2 bits of register d, and the con- tents of the high-order 1 bit of register d is 0 . (figure 4). register d is undefined after system is released from reset and re- turned from the ram back-up. accordingly, set the initial value. fig. 1 amc instruction execution example fig. 2 rar instruction execution example fig. 3 registers a, b and register e fig. 4 tabp p instruction execution example (cy) ( m ( d p ) ) ( a ) addition a l u < r e s u l t > cy a 3 a 2 a 1 a 0 a 0 cy a 3 a 2 a 1 rar instruction sc instruction < c l e a r > r c i n s t r u c t i o n a 3 a 2 a 1 a 0 b 3 b 2 b 1 b 0 e 7 e 6 e 5 e 4 e 3 e 2 e 1 e 0 a 3 a 2 a 1 a 0 b 3 b 2 b 1 b 0 t a b i n s t r u c t i o n t e a b i n s t r u c t i o n t a b e i n s t r u c t i o n tba instruction register b r e g i s t e r a register b register a register e specifying address tabp p instruction p 6 p 5 p 4 p 3 p 2 p 1 p 0 pc h dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 pc l immediate field value p the contents of register d rom 84 0 middle-order 4 bits low-order 4bits register a (4) register b (4) the contents of register a high-order 2 bits register d (3) high-order 1 bit of register d is 0 .
function block operations 4519 group hardware 1-18 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) stack registers (sk s ) and stack pointer (sp) stack registers (sks) are used to temporarily store the contents of program counter (pc) just before branching until returning to the original routine when; branching to an interrupt service routine (referred to as an inter- rupt service routine), performing a subroutine call, or executing the table reference instruction (tabp p). stack registers (sks) are eight identical registers, so that subrou- tines can be nested up to 8 levels. however, one of stack registers is used respectively when using an interrupt service routine and when executing a table reference instruction. accordingly, be care- ful not to over the stack when performing these operations together. the contents of registers sks are destroyed when 8 lev- els are exceeded. the register sk nesting level is pointed automatically by 3-bit stack pointer (sp). the contents of the stack pointer (sp) can be transferred to register a with the tasp instruction. figure 5 shows the stack registers (sks) structure. figure 6 shows the example of operation at subroutine call. (6) interrupt stack register (sdp) interrupt stack register (sdp) is a 1-stage register. when an inter- rupt occurs, this register (sdp) is used to temporarily store the contents of data pointer, carry flag, skip flag, register a, and regis- ter b just before an interrupt until returning to the original routine. unlike the stack registers (sks), this register (sdp) is not used when executing the subroutine call instruction and the table refer- ence instruction. (7) skip flag skip flag controls skip decision for the conditional skip instructions and continuous described skip instructions. when an interrupt oc- curs, the contents of skip flag is stored automatically in the interrupt stack register (sdp) and the skip condition is retained. fig. 5 stack registers (sks) structure fig. 6 example of operation at subroutine call s k 0 s k 1 s k 2 s k 3 s k 4 s k 5 s k 6 s k 7 ( s p ) = 0 ( s p ) = 1 ( s p ) = 2 ( s p ) = 3 ( s p ) = 4 ( s p ) = 5 ( s p ) = 6 ( s p ) = 7 program counter (pc) e x e c u t i n g r t i n s t r u c t i o n e x e c u t i n g b m i n s t r u c t i o n s t a c k p o i n t e r ( s p ) p o i n t s 7 a t r e s e t o r r e t u r n i n g f r o m r a m b a c k - u p m o d e . i t p o i n t s 0 b y e x e c u t i n g t h e f i r s t b m i n s t r u c t i o n , a n d t h e c o n t e n t s o f p r o g r a m c o u n t e r i s s t o r e d i n s k 0 . w h e n t h e b m i n s t r u c t i o n i s e x e c u t e d a f t e r e i g h t s t a c k r e g i s t e r s a r e u s e d ( ( s p ) = 7 ) , ( s p ) = 0 a n d t h e c o n t e n t s o f s k 0 i s d e s t r o y e d . returning to the bm instruction execution address with the rt instruction, and the bm instruction becomes the nop instruction. (sp) note :
function block operations 4519 group hardware 1-19 rev.1.00 aug 06, 2004 rej09b0175-0100z (8) program counter (pc) program counter (pc) is used to specify a rom address (page and address). it determines a sequence in which instructions stored in rom are read. it is a binary counter that increments the number of instruction bytes each time an instruction is executed. however, the value changes to a specified address when branch instructions, subroutine call instructions, return instructions, or the table refer- ence instruction (tabp p) is executed. program counter consists of pc h (most significant bit to bit 7) which specifies to a rom page and pc l (bits 6 to 0) which speci- fies an address within a page. after it reaches the last address (address 127) of a page, it specifies address 0 of the next page (figure 7). make sure that the pc h does not specify after the last page of the built-in rom. (9) data pointer (dp) data pointer (dp) is used to specify a ram address and consists of registers z, x, and y. register z specifies a ram file group, reg- ister x specifies a file, and register y specifies a ram digit (figure 8). register y is also used to specify the port d bit position. when using port d, set the port d bit position to register y certainly and execute the sd, rd, or szd instruction (figure 9). note register z of data pointer is undefined after system is released from reset. also, registers z, x and y are undefined in the ram back-up. after system is returned from the ram back-up, set these registers. fig. 7 program counter (pc) structure fig. 8 data pointer (dp) structure fig. 9 sd instruction execution example p 5 p 4 p 3 p 2 p 1 p 0 a 6 a 5 a 4 a 3 a 2 a 1 a 0 p r o g r a m c o u n t e r p c h s p e c i f y i n g p a g e p c l s p e c i f y i n g a d d r e s s p 6 z 1 z 0 x 3 x 2 x 1 x 0 y 3 y 2 y 1 y 0 d a t a p o i n t e r ( d p ) register z (2) r e g i s t e r x ( 4 ) register y (4) s p e c i f y i n g r a m d i g i t s p e c i f y i n g r a m f i l e specifying ram file group 0 01 1 set specifying bit position port d output latch register y (4) d 2 d 3 d 1 d 0 0
function block operations 4519 group hardware 1-20 rev.1.00 aug 06, 2004 rej09b0175-0100z program memory (rom) the program memory is a mask rom. 1 word of rom is composed of 10 bits. rom is separated every 128 words by the unit of page (addresses 0 to 127). table 1 shows the rom size and pages. fig- ure 10 shows the rom map of m34519m8/e8. table 1 rom size and pages part number m34519m6 m34519m8/e8 rom (prom) size ( ? fig. 10 rom map of m34519m8/e8 fig. 11 page 1 (addresses 0080 16 to 00ff 16 ) structure 90 87 654 321 interrupt address page 0000 16 0080 16 017 f 16 subroutine special page 007 f 16 00 ff 16 0100 16 1 fff 16 0180 16 page 1 page 2 page 0 page 3 pa g e 63 90 8765 432 1 external 0 interrupt address 0080 16 0082 16 0084 16 timer 1 interrupt address timer 2 interrupt address 0086 16 0088 16 008a 16 008c 16 008e 16 00ff 16 a/d interrupt address external 1 interrupt address timer 3 interrupt address timer 4 interrupt address serial i/o interrupt address
function block operations 4519 group hardware 1-21 rev.1.00 aug 06, 2004 rej09b0175-0100z data memory (ram) 1 word of ram is composed of 4 bits, but 1-bit manipulation (with the sb j, rb j, and szb j instructions) is enabled for the entire memory area. a ram address is specified by a data pointer. the data pointer consists of registers z, x, and y. set a value to the data pointer certainly when executing an instruction to access ram (also, set a value after system returns from ram back-up). table 2 shows the ram size. figure 12 shows the ram map. note register z of data pointer is undefined after system is released from reset. also, registers z, x and y are undefined in the ram back-up. after system is returned from the ram back-up, set these registers. fig. 12 ram map table 2 ram size part number m34519m6 m34519m8/e8 ram size 384 words ? ?
function block operations 4519 group hardware 1-22 rev.1.00 aug 06, 2004 rej09b0175-0100z interrupt function the interrupt type is a vectored interrupt branching to an individual address (interrupt address) according to each interrupt source. an interrupt occurs when the following 3 conditions are satisfied. an interrupt activated condition is satisfied (request flag = 1 ) interrupt enable bit is enabled ( 1 ) interrupt enable flag is enabled (inte = 1 ) table 3 shows interrupt sources. (refer to each interrupt request flag for details of activated conditions.) (1) interrupt enable flag (inte) the interrupt enable flag (inte) controls whether the every inter- rupt enable/disable. interrupts are enabled when inte flag is set to 1 with the ei instruction and disabled when inte flag is cleared to 0 with the di instruction. when any interrupt occurs, the inte flag is automatically cleared to 0, so that other interrupts are disabled until the ei instruction is executed. (2) interrupt enable bit use an interrupt enable bit of interrupt control registers v1 and v2 to select the corresponding interrupt or skip instruction. table 4 shows the interrupt request flag, interrupt enable bit and skip instruction. table 5 shows the interrupt enable bit function. (3) interrupt request flag when the activated condition for each interrupt is satisfied, the cor- responding interrupt request flag is set to 1. each interrupt request flag is cleared to 0 when either; an interrupt occurs, or the next instruction is skipped with a skip instruction. each interrupt request flag is set when the activated condition is satisfied even if the interrupt is disabled by the inte flag or its in- terrupt enable bit. once set, the interrupt request flag retains set until a clear condition is satisfied. accordingly, an interrupt occurs when the interrupt disable state is released while the interrupt request flag is set. if more than one interrupt request flag is set when the interrupt dis- able state is released, the interrupt priority level is as follows shown in table 3. table 3 interrupt sources activated condition level change of int0 pin level change of int1 pin timer 1 underflow timer 2 underflow timer 3 underflow timer 4 underflow completion of a/d conversion completion of serial i/o transmit/receive priority level 1 2 3 4 5 6 7 8 interrupt name external 0 interrupt external 1 interrupt timer 1 interrupt timer 2 interrupt timer 3 interrupt timer 4 interrupt a/d interrupt serial i/o interrupt interrupt request flag exf0 exf1 t1f t2f t3f t4f adf siof interrupt name external 0 interrupt external 1 interrupt timer 1 interrupt timer 2 interrupt timer 3 interrupt timer 4 interrupt a/d interrupt serial i/o interrupt table 5 interrupt enable bit function occurrence of interrupt enabled disabled skip instruction invalid valid interrupt enable bit 1 0 interrupt address address 0 in page 1 address 2 in page 1 address 4 in page 1 address 6 in page 1 address 8 in page 1 address a in page 1 address c in page 1 address e in page 1 table 4 interrupt request flag, interrupt enable bit and skip in- struction skip instruction snz0 snz1 snzt1 snzt2 snzt3 snzt4 snzad snzsi interrupt enable bit v1 0 v1 1 v1 2 v1 3 v2 0 v2 1 v2 2 v2 3
function block operations 4519 group hardware 1-23 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) internal state during an interrupt the internal state of the microcomputer during an interrupt is as fol- lows (figure 14). program counter (pc) an interrupt address is set in program counter. the address to be executed when returning to the main routine is automatically stored in the stack register (sk). interrupt enable flag (inte) inte flag is cleared to 0 so that interrupts are disabled. interrupt request flag only the request flag for the current interrupt source is cleared to 0. data pointer, carry flag, skip flag, registers a and b the contents of these registers and flags are stored automatically in the interrupt stack register (sdp). (5) interrupt processing when an interrupt occurs, a program at an interrupt address is ex- ecuted after branching a data store sequence to stack register. write the branch instruction to an interrupt service routine at an in- terrupt address. use the rti instruction to return from an interrupt service routine. interrupt enabled by executing the ei instruction is performed after executing 1 instruction (just after the next instruction is executed). accordingly, when the ei instruction is executed just before the rti instruction, interrupts are enabled after returning the main routine. (refer to figure 13) fig. 13 program example of interrupt processing program counter (pc) ............................................................... each interrupt address stack register (sk) .................................................................................................... interrupt enable flag (inte) .................................................................. 0 (interrupt disabled) interrupt request flag (only the flag for the current interrupt source) ................................................................................... 0 data pointer, carry flag, registers a and b, skip flag ........ stored in the interrupt stack register (sdp) automatically the address of main routine to be executed when returning fig. 15 interrupt system diagram fig. 14 internal state when interrupt occurs e i r t i i n t e r r u p t s e r v i c e r o u t i n e interrupt occurs interrupt is enabled m a i n r o u t i n e : i n t e r r u p t e n a b l e d s t a t e : i n t e r r u p t d i s a b l e d s t a t e v1 1 exf0 v1 0 address 2 in page 1 address 4 in page 1 address 0 in page 1 timer 1 underflow timer 2 underflow t1f v1 2 request flag (state retained) enable bit enable flag activated condition v1 3 address 6 in page 1 a/d conversion completed inte adf t2f v2 0 t3f v2 1 siof v2 3 t4f v2 2 int0 pin interrupt waveform input timer 3 underflow timer 4 underflow serial i/o transmit/ receive completed int1 pin interrupt waveform input exf1 address 8 in page 1 address a in page 1 address c in page 1 address e in page 1
function block operations 4519 group hardware 1-24 rev.1.00 aug 06, 2004 rej09b0175-0100z (6) interrupt control registers interrupt control register v1 interrupt enable bits of external 0, external 1, timer 1 and timer 2 are assigned to register v1. set the contents of this register through register a with the tv1a instruction. the tav1 instruction can be used to transfer the contents of register v1 to register a. interrupt control register v2 the timer 3, timer 4, a/d and serial i/o interrupt enable bit is as- signed to register v2. set the contents of this register through register a with the tv2a instruction. the tav2 instruction can be used to transfer the contents of register v2 to register a. table 6 interrupt control registers note: r represents read enabled, and w represents write enabled. (7) interrupt sequence interrupts only occur when the respective inte flag, interrupt en- able bits (v1 0 v1 3 , v2 0 v2 3 ), and interrupt request flag are 1. the interrupt actually occurs 2 to 3 machine cycles after the cycle in which all three conditions are satisfied. the interrupt occurs after 3 machine cycles only when the three interrupt conditions are sat- isfied on execution of other than one-cycle instructions (refer to figure 16). interrupt disabled (snzsi instruction is valid) interrupt enabled (snzsi instruction is invalid) interrupt disabled (snzad instruction is valid) interrupt enabled (snzad instruction is invalid) interrupt disabled (snzt4 instruction is valid) interrupt enabled (snzt4 instruction is invalid) interrupt disabled (snzt3 instruction is valid) interrupt enabled (snzt3 instruction is invalid) v1 3 v1 2 v1 1 v1 0 v2 3 v2 2 v2 1 v2 0 serial i/o interrupt enable bit a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit interrupt control register v2 at ram back-up : 0000 2 at reset : 0000 2 0 1 0 1 0 1 0 1 interrupt control register v1 timer 2 interrupt enable bit timer 1 interrupt enable bit external 1 interrupt enable bit external 0 interrupt enable bit interrupt disabled (snzt2 instruction is valid) interrupt enabled (snzt2 instruction is invalid) interrupt disabled (snzt1 instruction is valid) interrupt enabled (snzt1 instruction is invalid) interrupt disabled (snz1 instruction is valid) interrupt enabled (snz1 instruction is invalid) interrupt disabled (snz0 instruction is valid) interrupt enabled (snz0 instruction is invalid) 0 1 0 1 0 1 0 1 at ram back-up : 0000 2 at reset : 0000 2 r/w tav1/tv1a r/w tav2/tv2a
function block operations 4519 group hardware 1-25 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 16 interrupt sequence t1f,t2f,t3f,t4f, adf,siof int0,int1 exf0,exf1 t 1 t 2 t 3 t 1 t 2 t 3 t 2 t 3 t 1 t 1 t 2 t 3 t 1 t 2
function block operations 4519 group hardware 1-26 rev.1.00 aug 06, 2004 rej09b0175-0100z table 7 external interrupt activated conditions name external 0 interrupt external 1 interrupt input pin p3 0 /int0 p3 1 /int1 activated condition when the next waveform is input to p3 0 /int0 pin falling waveform ( h l ) rising waveform ( l h ) both rising and falling waveforms when the next waveform is input to p3 1 /int1 pin falling waveform ( h l ) rising waveform ( l h ) both rising and falling waveforms valid waveform selection bit i1 1 i1 2 i2 1 i2 2 fig. 17 external interrupt circuit structure external interrupts the 4519 group has the external 0 interrupt and external 1 inter- rupt. an external interrupt request occurs when a valid waveform is input to an interrupt input pin (edge detection). the external interrupt can be controlled with the interrupt control registers i1 and i2. rising falling one-sided edge detection circuit key-on wakeup external 1 interrupt timer 3 count start synchronous circuit level detection circuit edge detection circuit skip decision (snzi1 instruction) both edges detection circuit 0 1 i2 2 0 1 exf1 i2 1 p3 1 /int1 k2 2 i2 3 0 1 k2 3 rising 0 1 falling i1 2 one-sided edge detection circuit key-on wakeup 0 1 exf0 external 0 interrupt i1 1 p3 0 /int0 k2 0 timer 1 count start synchronous circuit i1 3 (note 1) level detection circuit edge detection circuit 0 1 k2 1 skip decision (snzi0 instruction) both edges detection circuit this symbol represents a parasitic diode on the port. notes 1: (note 2) (note 3) (note 1) (note 2) (note 3) 2: i1 2 (i2 2 ) = 0: l level detected i1 2 (i2 2 ) = 1: h level detected 3: i1 2 (i2 2 ) = 0: falling edge detected i1 2 (i2 2 ) = 1: rising edge detected period measurement circuit input
function block operations 4519 group hardware 1-27 rev.1.00 aug 06, 2004 rej09b0175-0100z (1) external 0 interrupt request flag (exf0) external 0 interrupt request flag (exf0) is set to 1 when a valid waveform is input to p3 0 /int0 pin. the valid waveforms causing the interrupt must be retained at their level for 4 clock cycles or more of the system clock (refer to figure 16). the state of exf0 flag can be examined with the skip instruction (snz0). use the interrupt control register v1 to select the interrupt or the skip instruction. the exf0 flag is cleared to 0 when an in- terrupt occurs or when the next instruction is skipped with the skip instruction. external 0 interrupt activated condition external 0 interrupt activated condition is satisfied when a valid waveform is input to p3 0 /int0 pin. the valid waveform can be selected from rising waveform, falling waveform or both rising and falling waveforms. an example of how to use the external 0 interrupt is as follows. ? 1 for the int0 pin to be in the in- put enabled state. ? ? 0 with the snz0 instruction. ? ? 1. the external 0 interrupt is now enabled. now when a valid wave- form is input to the p3 0 /int0 pin, the exf0 flag is set to 1 and the external 0 interrupt occurs. (2) external 1 interrupt request flag (exf1) external 1 interrupt request flag (exf1) is set to 1 when a valid waveform is input to p3 1 /int1 pin. the valid waveforms causing the interrupt must be retained at their level for 4 clock cycles or more of the system clock (refer to figure 16). the state of exf1 flag can be examined with the skip instruction (snz1). use the interrupt control register v1 to select the interrupt or the skip instruction. the exf1 flag is cleared to 0 when an in- terrupt occurs or when the next instruction is skipped with the skip instruction. external 1 interrupt activated condition external 1 interrupt activated condition is satisfied when a valid waveform is input to p3 1 /int1 pin. the valid waveform can be selected from rising waveform, falling waveform or both rising and falling waveforms. an example of how to use the external 1 interrupt is as follows. ? 1 for the int1 pin to be in the in- put enabled state. ? ? 0 with the snz1 instruction. ? ? 1. the external 1 interrupt is now enabled. now when a valid wave- form is input to the p3 1 /int1 pin, the exf1 flag is set to 1 and the external 1 interrupt occurs.
function block operations 4519 group hardware 1-28 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) external interrupt control registers interrupt control register i1 register i1 controls the valid waveform for the external 0 inter- rupt. set the contents of this register through register a with the ti1a instruction. the tai1 instruction can be used to transfer the contents of register i1 to register a. table 8 external interrupt control register interrupt control register i2 register i2 controls the valid waveform for the external 1 inter- rupt. set the contents of this register through register a with the ti2a instruction. the tai2 instruction can be used to transfer the contents of register i2 to register a. i1 3 i1 2 i1 1 i1 0 int0 pin input control bit interrupt valid waveform for int0 pin/ return level selection bit int0 pin edge detection circuit control bit int0 pin timer 1 count start synchronous circuit selection bit interrupt control register i1 r/w tai1/ti1a at ram back-up : state retained at reset : 0000 2 int0 pin input disabled int0 pin input enabled falling waveform/ l level ( l level is recognized with the snzi0 instruction) rising waveform/ h level ( h level is recognized with the snzi0 instruction) one-sided edge detected both edges detected timer 1 count start synchronous circuit not selected timer 1 count start synchronous circuit selected 0 1 0 1 0 1 0 1 i2 3 i2 2 i2 1 i2 0 int1 pin input control bit (note 2) interrupt valid waveform for int1 pin/ return level selection bit (note 2) int1 pin edge detection circuit control bit int1 pin timer 3 count start synchronous circuit selection bit interrupt control register i2 r/w tai2/ti2a at ram back-up : state retained at reset : 0000 2 int1 pin input disabled int1 pin input enabled falling waveform/ l level ( l level is recognized with the snzi1 instruction) rising waveform/ h level ( h level is recognized with the snzi1 instruction) one-sided edge detected both edges detected timer 3 count start synchronous circuit not selected timer 3 count start synchronous circuit selected 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i1 2 , i1 3 i2 2 and i2 3 are changed, the external interrupt request flag (exf0, exf1) may be set.
function block operations 4519 group hardware 1-29 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) notes on external 0 interrupt ? depending on the input state of the p3 0 /int0 pin, the external 0 interrupt request flag (exf0) may be set when the bit 3 of regis- ter i1 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 0 of register v1 to 0 (refer to figure 18 ? 0 after executing at least one instruction (refer to figure 18 ? ? ??? ? ??? ? ? ? fig. 18 external 0 interrupt program example-1 ? 0 , the ram back-up mode is selected and the input of int0 pin is disabled, be careful about the following notes. when the input of int0 pin is disabled (register i1 3 = 0 ), set the key-on wakeup function to be invalid (register k2 0 = 0 ) before system enters to the ram back-up mode. (refer to figure 19 ? la 0 ; ( ??? ? ? fig. 19 external 0 interrupt program example-2 ? depending on the input state of the p3 0 /int0 pin, the external 0 interrupt request flag (exf0) may be set when the bit 2 of regis- ter i1 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 0 of register v1 to 0 (refer to figure 20 ? 0 after executing at least one instruction (refer to figure 20 ? ? ??? ? ? ?? ? ? ? fig. 20 external 0 interrupt program example-3
function block operations 4519 group hardware 1-30 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) notes on external 1 interrupt ? depending on the input state of the p3 1 /int1 pin, the external 1 interrupt request flag (exf1) may be set when the bit 3 of regis- ter i2 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 1 of register v1 to 0 (refer to figure 21 ? 0 after executing at least one instruction (refer to figure 21 ? ? ?? ? ? ??? ? ? ? fig. 21 external 1 interrupt program example-1 ? 0 , the ram back-up mode is selected and the input of int1 pin is disabled, be careful about the following notes. when the input of int1 pin is disabled (register i2 3 = 0 ), set the key-on wakeup function to be invalid (register k2 2 = 0 ) before system enters to the ram back-up mode. (refer to figure 22 ? la 0 ; ( ? ?? ? ? fig. 22 external 1 interrupt program example-2 ? depending on the input state of the p3 1 /int1 pin, the external 1 interrupt request flag (exf1) may be set when the bit 2 of regis- ter i2 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 1 of register v1 to 0 (refer to figure 23 ? 0 after executing at least one instruction (refer to figure 23 ? ? ?? ? ? ? ?? ? ? ? fig. 23 external 1 interrupt program example-3
function block operations 4519 group hardware 1-31 rev.1.00 aug 06, 2004 rej09b0175-0100z timers the 4519 group has the following timers. programmable timer the programmable timer has a reload register and enables the frequency dividing ratio to be set. it is decremented from a set- ting value n. when it underflows (count to n + 1), a timer interrupt request flag is set to 1, new data is loaded from the reload reg- ister, and count continues (auto-reload function). fixed dividing frequency timer the fixed dividing frequency timer has the fixed frequency divid- ing ratio (n). an interrupt request flag is set to 1 after every n count of a count pulse. fig. 24 auto-reload function the 4519 group timer consists of the following circuits. prescaler : 8-bit programmable timer timer 1 : 8-bit programmable timer timer 2 : 8-bit programmable timer timer 3 : 8-bit programmable timer timer 4 : 8-bit programmable timer watchdog timer : 16-bit fixed dividing frequency timer (timers 1, 2, 3, and 4 have the interrupt function, respectively) prescaler and timers 1, 2, 3, and 4 can be controlled with the timer control registers pa, w1 to w6. the watchdog timer is a free counter which is not controlled with the control register. each function is described below. ff 16 n 00 16 n : c o u n t e r i n i t i a l v a l u e c o u n t s t a r t s r e l o a d reload 1 s t u n d e r f l o w 2 n d u n d e r f l o w n+1 coun t n+1 coun t t i m e a n i n t e r r u p t o c c u r s o r a s k i p i n s t r u c t i o n i s e x e c u t e d . timer interrupt request flag t h e c o n t e n t s o f c o u n t e r 1 0
function block operations 4519 group hardware 1-32 rev.1.00 aug 06, 2004 rej09b0175-0100z count source instruction clock (instck) instruction clock (instck) prescaler output (orclk) x in input cntr0 input system clock (stck) prescaler output (orclk) timer 1 underflow (t1udf) pwm output (pwmout) pwm output (pwmout) prescaler output (orclk) timer 2 underflow (t2udf) cntr1 input x in input prescaler output (orclk) instruction clock (instck) structure 8-bit programmable binary down counter 8-bit programmable binary down counter (link to int0 input) (period/pulse width measurement function) 8-bit programmable binary down counter 8-bit programmable binary down counter (link to int1 input) 8-bit programmable binary down counter (pwm output function) 16-bit fixed dividing frequency circuit prescaler timer 1 timer 2 timer 3 timer 4 watchdog timer use of output signal timer 1, 2, 3, amd 4 count sources timer 2 count source cntr0 output timer 1 interrupt timer 3 count source cntr0 output timer 2 interrupt cntr1 output control timer 3 interrupt timer 2, 3 count source cntr1 output timer 4 interrupt system reset (count twice) wdf flag decision frequency dividing ratio 1 to 256 1 to 256 1 to 256 1 to 256 1 to 256 65534 control register pa w1 w2 w5 w2 w3 w4 table 9 function related timers
function block operations 4519 group hardware 1-33 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 25 timer structure (1) system clock (stck) instruction clock (instck) multi- plexer (cmck, crck, cyck) (note 1) mr 0 1 0 orclk reload register rps (8) prescaler (8) register b register a (tabps) (tabps) (tpsab) pa 0 mr 3 , mr 2 01 00 10 11 instck w1 1 , w1 0 (note 3) 10 11 01 00 orclk x in t1f (tab1) (tab1) (t1ab) (t1ab) (t1ab) (tpsab) (tpsab) on-chip oscillator x in ceramic resonance rc oscillation timer 1 (8) timer 1 interrupt reload register r1 (8) register b register a timer 1 underflow signal ( t1udf) internal clock generating circuit (divided by 3) quartz-crystal oscillation w1 2 stck w2 1 , w2 0 10 11 01 00 orclk t1udf pwmout t2f (tab2) (tab2) (t2ab) (t2ab) (t2ab) timer 2 interrupt timer 2 underflow signal (t2udf) timer 2 (8) reload register r2 (8) register b register a w2 2 0 1 w5 2 0 1 i1 2 0 1 p3 0 /int0 w1 3 t1udf i1 0 i1 3 i1 1 one-sided edge detection circuit both edges detection circuit 0 1 i1 0 s r q w5 1 , w5 0 10 11 01 00 w5 2 one-period generation circuit 1/16 on-chip oscillator 0 1 w6 2 d 6 /cntr0 0 1 w6 0 port d 6 output 0 1 w2 3 1/2 t1udf 1/2 t2udf (note 2) (tr1ab) tr1ab: pwmout: this instruction is used to transfer the contents of register a and register b to only reload register r1. pwm output signal (from timer 4 output unit) data is set automatically from each reload register when timer underflows (auto-reload function). notes 1: when cmck instruction is executed, ceramic resonance is selected. when crck instruction is executed, rc oscillation is selected. when cyck instruction is executed, quartz-crystal oscillator is selected. 2: timer 1 count start synchronous circuit is set by the valid edge of p3 0 /int0 pin selected by bits 1 (i1 1 ) and 2 (i1 2 ) of register i1. 3: x in cannot be used for the count source when bit 1 (mr 1 ) of register mr is set to 1 and f(x in ) oscillation is stopped. 0 1 w5 2 divided by 4 divided by 2 divided by 8 division circuit
function block operations 4519 group hardware 1-34 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 26 timer structure (2) 1 - - - - - - - - - - - - - - 16 w a t c h d o g t i m e r instck q r s w d f 1 w r s t i n s t r u c t i o n q r s wef dwdt instruction + wrst instruction r e s e t s i g n a l q t d r reset signal watchdog reset signal pwmout 0 1 i 2 2 0 1 p 3 1 / i n t 1 w 3 3 t 3 u d f i 2 0 i 2 3 i2 1 w 3 1 , w 3 0 1 0 1 1 0 1 0 0 o r c l k t2udf t 3 f (tab3) ( t a b 3 ) ( t 3 a b ) ( t 3 a b )(t3ab) timer 3 (8) t i m e r 3 i n t e r r u p t reload register r3 (8) r e g i s t e r b r e g i s t e r a t i m e r 3 u n d e r f l o w s i g n a l ( t 3 u d f ) o ne-s id e d e d ge detection circuit b ot h e d ges detection circuit w 3 2 1 0 w 6 3 0 1 i2 0 s r q 1 0 w 4 3 pwmod q r d t w3 2 w 6 1 t 3 u d f port d 7 output d 7 / c n t r 1 register b r e g i s t e r a r e l o a d r e g i s t e r r 4 h ( 8 ) ( t a b 4 ) ( t a b 4 ) (t4ab) ( t 4 a b ) ( t 4 a b ) timer 4 (8) reload register r4l (8) register b register a reload control circuit w 4 1 1 0 w4 0 1/2 o r c l k x in h i n t e r v a l e x p a n s i o n 0 1 w 4 2 t 4 f r q t w 4 3 pwmout ( t 4 h a b ) (t4r4l) t i m e r 4 i n t e r r u p t (note 4) (tr3ab) (note 3) (note 5) (note 6) t r 3 a b: t 4 r 4 l : i n s t c k : o r c l k : t h i s i n s t r u c t i o n i s u s e d t o t r a n s f e r t h e c o n t e n t s o f r e g i s t e r a a n d r e g i s t e r b t o o n l y r e l o a d r e g i s t e r r 3 . t h i s i n s t r u c t i o n i s u s e d t o t r a n s f e r t h e c o n t e n t s o f r e l o a d r e g i s t e r r 4 l t o t i m e r 4 . i n s t r u c t i o n c l o c k ( s y s t e m c l o c k d i v i d e d b y 3 ) p r e s c a l e r o u t p u t ( i n s t r u c t i o n c l o c k d i v i d e d b y 1 t o 2 5 6 ) data is set automatically from each reload register when timer underflows (auto-reload function). notes 3: x in cannot be used for the count source when bit 1 (mr 1 ) of register mr is set to ??and f(x in ) oscillation is stopped. 4: timer 3 count start synchronous circuit is set by the valid edge of p3 1 /int1 pin selected by bits 1 (i2 1 ) and 2 (i2 2 ) of register i2. 5: flag wdf1 is cleared to ??and the next instruction is skipped when the wrst instruction is executed while flag wdf1 = ?? the next instruction is not skipped even when the wrst instruction is executed while flag wdf1 = ?? 6: flag wef is cleared to ??and watchdog timer reset does not occur when the dwdt instruction and wrst instruction are executed continuously. 7: the wef flag is set to ??at system reset or ram back-up mode. (note 7)
function block operations 4519 group hardware 1-35 rev.1.00 aug 06, 2004 rej09b0175-0100z notes 1: r represents read enabled, and w represents write enabled. 2: this function is valid only when the timer 1 count start synchronous circuit is selected (i1 0 = 1 ). 3: this function is valid only when the timer 3 count start synchronous circuit is selected (i2 0 = 1 ). table 10 timer related registers w2 1 0 0 1 1 timer 1 underflow signal divided by 2 output timer 2 underflow signal divided by 2 output stop (state retained) operating count source system clock (stck) prescaler output (orclk) timer 1 underflow signal (t1udf) pwm signal (pwmout) cntr0 output signal selection bit (note 2) timer 2 control bit timer 2 count source selection bits 0 1 0 1 w2 0 0 1 0 1 timer control register w2 at ram back-up : state retained at reset : 0000 2 w2 3 w2 2 w2 1 w2 0 w1 1 0 0 1 1 timer 1 count auto-stop circuit not selected timer 1 count auto-stop circuit selected stop (state retained) operating count source instruction clock (instck) prescaler output (orclk) x in input cntr0 input timer 1 count auto-stop circuit selection bit (note 2) timer 1 control bit timer 1 count source selection bits 0 1 0 1 w1 0 0 1 0 1 timer control register w1 r/w taw1/tw1a at ram back-up : state retained at reset : 0000 2 w1 3 w1 2 w1 1 w1 0 r/w taw2/tw2a w3 1 0 0 1 1 timer 3 count auto-stop circuit not selected timer 3 count auto-stop circuit selected stop (state retained) operating count source pwm signal (pwmout) prescaler output (orclk) timer 2 underflow signal (t2udf) cntr1 input timer 3 count auto-stop circuit selection bit (note 3) timer 3 control bit timer 3 count source selection bits 0 1 0 1 w3 0 0 1 0 1 timer control register w3 at ram back-up : state retained at reset : 0000 2 w3 3 w3 2 w3 1 w3 0 r/w taw3/tw3a 0 1 stop (state initialized) operating prescaler control bit timer control register pa w tpaa at ram back-up : 0 2 at reset : 0 2 pa 0
function block operations 4519 group hardware 1-36 rev.1.00 aug 06, 2004 rej09b0175-0100z falling edge rising edge falling edge rising edge cntr1 output auto-control circuit not selected cntr1 output auto-control circuit selected d 6 (i/o) / cntr0 (input) cntr0 (i/o) /d 6 (input) cntr1 pin input count edge selection bit cntr0 pin input count edge selection bit cntr1 output auto-control circuit selection bit d 6 /cntr0 pin function selection bit 0 1 0 1 0 1 0 1 timer control register w6 at ram back-up : state retained at reset : 0000 2 w6 3 w6 2 w6 1 w6 0 d 7 (i/o) / cntr1 (input) cntr1 (i/o) / d 7 (input) pwm signal h interval expansion function invalid pwm signal h interval expansion function valid stop (state retained) operating x in input prescaler output (orclk) divided by 2 d 7 /cntr1 pin function selection bit pwm signal h interval expansion function control bit timer 4 control bit timer 4 count source selection bit 0 1 0 1 0 1 0 1 w4 3 w4 2 w4 1 w4 0 w5 1 0 0 1 1 not used period measurement circuit control bit signal for period measurement selection bits 0 1 0 1 w5 0 0 1 0 1 timer control register w5 at ram back-up : state retained at reset : 0000 2 w5 3 w5 2 w5 1 w5 0 this bit has no function, but read/write is enabled. stop operating count source on-chip oscillator (f(ring/16)) cntr 0 pin input int0 pin input not available r/w taw4/tw4a timer control register w4 at ram back-up : 0000 2 at reset : 0000 2 r/w taw5/tw5a r/w taw6/tw6a note: r represents read enabled, and w represents write enabled.
function block operations 4519 group hardware 1-37 rev.1.00 aug 06, 2004 rej09b0175-0100z (1) timer control registers timer control register pa register pa controls the count operation of prescaler. set the contents of this register through register a with the tpaa instruc- tion. timer control register w1 register w1 controls the selection of timer 1 count auto-stop cir- cuit, and the count operation and count source of timer 1. set the contents of this register through register a with the tw1a instruc- tion. the taw1 instruction can be used to transfer the contents of register w1 to register a. timer control register w2 register w2 controls the selection of cntr0 output, and the count operation and count source of timer 2. set the contents of this register through register a with the tw2a instruction. the taw2 instruction can be used to transfer the contents of register w2 to register a. timer control register w3 register w3 controls the selection of the count operation and count source of timer 3 count auto-stop circuit. set the contents of this register through register a with the tw3a instruction. the taw3 instruction can be used to transfer the contents of register w3 to register a. timer control register w4 register w4 controls the d 7 /cntr1 output, the expansion of h interval of pwm output, and the count operation and count source of timer 4. set the contents of this register through regis- ter a with the tw4a instruction. the taw4 instruction can be used to transfer the contents of register w4 to register a. timer control register w5 register w5 controls the period measurement circuit and target signal for period measurement. set the contents of this register through register a with the tw5a instruction. the taw5 instruc- tion can be used to transfer the contents of register w5 to register a. timer control register w6 register w6 controls the count edges of cntr0 pin and cntr1 pin, selection of cntr1 output auto-control circuit and the d 6 / cntr0 pin function. set the contents of this register through reg- ister a with the tw6a instruction. the taw6 instruction can be used to transfer the contents of register w6 to register a.. (2) prescaler prescaler is an 8-bit binary down counter with the prescaler reload register prs. data can be set simultaneously in prescaler and the reload register rps with the tpsab instruction. data can be read from reload register rps with the tabps instruction. stop counting and then execute the tpsab or tabps instruction to read or set prescaler data. prescaler starts counting after the following process; ? ? 1. when a value set in reload register rps is n, prescaler divides the count source signal by n + 1 (n = 0 to 255). count source for prescaler is the instruction clock (instck). once count is started, when prescaler underflows (the next count pulse is input after the contents of prescaler becomes 0 ), new data is loaded from reload register rps, and count continues (auto-reload function). the output signal (orclk) of prescaler can be used for timer 1, 2, 3, and 4 count sources. (3) timer 1 (interrupt function) timer 1 is an 8-bit binary down counter with the timer 1 reload reg- ister (r1). data can be set simultaneously in timer 1 and the reload register (r1) with the t1ab instruction. data can be written to re- load register (r1) with the tr1ab instruction. data can be read from timer 1 with the tab1 instruction. stop counting and then execute the t1ab or tab1 instruction to read or set timer 1 data. when executing the tr1ab instruction to set data to reload regis- ter r1 while timer 1 is operating, avoid a timing when timer 1 underflows. timer 1 starts counting after the following process; ? ? ? 1. when a value set in reload register r1 is n, timer 1 divides the count source signal by n + 1 (n = 0 to 255). once count is started, when timer 1 underflows (the next count pulse is input after the contents of timer 1 becomes 0 ), the timer 1 interrupt request flag (t1f) is set to 1, new data is loaded from reload register r1, and count continues (auto-reload function). int0 pin input can be used as the start trigger for timer 1 count op- eration by setting the bit 0 of register i1 to 1. also, in this time, the auto-stop function by timer 1 underflow can be performed by setting the bit 3 of register w1 to 1. timer 1 underflow signal divided by 2 can be output from cntr0 pin by clearing bit 3 of register w2 to 0 and setting bit 0 of regis- ter w6 to 1 . the period measurement circuit starts operating by setting bit 2 of register w5 to 1 and timer 1 is used to count the one-period of the target signal for the period measurement. in this time, the timer 1 interrupt request flag (t1f) is not set by the timer 1 underflow sig- nal, it is the flag for detecting the completion of period measurement.
function block operations 4519 group hardware 1-38 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) timer 2 (interrupt function) timer 2 is an 8-bit binary down counter with the timer 2 reload reg- ister (r2). data can be set simultaneously in timer 2 and the reload register (r2) with the t2ab instruction. data can be read from timer 2 with the tab2 instruction. stop counting and then execute the t2ab or tab2 instruction to read or set timer 2 data. timer 2 starts counting after the following process; ? ? ? 1. when a value set in reload register r2 is n, timer 2 divides the count source signal by n + 1 (n = 0 to 255). once count is started, when timer 2 underflows (the next count pulse is input after the contents of timer 2 becomes 0 ), the timer 2 interrupt request flag (t2f) is set to 1, new data is loaded from reload register r2, and count continues (auto-reload function). timer 2 underflow signal divided by 2 can be output from cntr0 pin by setting bit 3 of register w2 to 1 and setting bit 0 of register w6 to 1 . (5) timer 3 (interrupt function) timer 3 is an 8-bit binary down counter with the timer 3 reload reg- ister (r3). data can be set simultaneously in timer 3 and the reload register (r3) with the t3ab instruction. data can be written to re- load register (r3) with the tr3ab instruction. data can be read from timer 3 with the tab3 instruction. stop counting and then execute the t3ab or tab3 instruction to read or set timer 3 data. when executing the tr3ab instruction to set data to reload regis- ter r3 while timer 3 is operating, avoid a timing when timer 3 underflows. timer 3 starts counting after the following process; ? ? ? 1. when a value set in reload register r3 is n, timer 3 divides the count source signal by n + 1 (n = 0 to 255). once count is started, when timer 3 underflows (the next count pulse is input after the contents of timer 3 becomes 0 ), the timer 3 interrupt request flag (t3f) is set to 1, new data is loaded from reload register r3, and count continues (auto-reload function). int1 pin input can be used as the start trigger for timer 3 count op- eration by setting the bit 0 of register i2 to 1. also, in this time, the auto-stop function by timer 3 underflow can be performed by setting the bit 3 of register w3 to 1. (6) timer 4 (interrupt function) timer 4 is an 8-bit binary down counter with two timer 4 reload reg- isters (r4l, r4h). data can be set simultaneously in timer 4 and the reload register r4l with the t4ab instruction. data can be set in the reload register r4h with the t4hab instruction. the contents of reload register r4l set with the t4ab instruction can be set to timer 4 again with the t4r4l instruction. data can be read from timer 4 with the tab4 instruction. stop counting and then execute the t4ab or tab4 instruction to read or set timer 4 data. when executing the t4hab instruction to set data to reload regis- ter r4h while timer 4 is operating, avoid a timing when timer 4 underflows. timer 4 starts counting after the following process; ? ? ? 1. when a value set in reload register r4l is n, timer 4 divides the count source signal by n + 1 (n = 0 to 255). once count is started, when timer 4 underflows (the next count pulse is input after the contents of timer 4 becomes 0 ), the timer 4 interrupt request flag (t4f) is set to 1, new data is loaded from reload register r4l, and count continues (auto-reload function). the pwm signal generated by timer 4 can be output from cntr1 pin by setting bit 3 of the timer control register w4 to 1 . timer 4 can control the pwm output to cntr1 pin with timer 3 by setting bit 1 of the timer control register w6 to 1 .
function block operations 4519 group hardware 1-39 rev.1.00 aug 06, 2004 rej09b0175-0100z la 0 ; ( ? ?? ? ? ?? ? ? ? fig. 27 period measurement circuit program example (7) period measurement function (timer 1, period measurement circuit) timer 1 has the period measurement circuit which performs timer count operation synchronizing with the one cycle of the signal di- vided by 16 of the on-chip oscillator, d 6 /cntr0 pin input, or p3 0 / int0 pin input (one cycle, h , or l pulse width at the case of a p3 0 /int0 pin input). when the target signal for period measurement is set by bits 0 and 1 of register w5, a period measurement circuit is started by setting the bit 2 of register w5 to 1 . then, if a x in input is set as the count source of a timer 1 and the bit 2 of register w1 is set to 1 , timer 1 starts operation. timer 1 starts operation synchronizing with the falling edge of the target signal for period measurement, and stops count operation synchronizing with the next falling edge (one-period generation circuit). when selecting d 6 /cntr0 pin input as target signal for period measurement, the period measurement synchronous edge can be changed into a rising edge by setting the bit 2 of register w6 to 1 . when selecting p3 0 /int0 pin input as target signal for period measurement, period measurement synchronous edge can be changed into a rising edge by setting the bit 2 of register i1 to 1 . a timer 1 interrupt request flag (t1f) is set to 1 after completing measurement operation. when a period measurement circuit is set to be operating, timer 1 interrupt request flag (t1f) is not set by timer 1 underflow sig- nal, but turns into a flag which detects the completion of period measurement. in addition, a timer 1 underflow signal can be used as timer 2 count source. once period measurement operation is completed, even if period measurement valid edge is input next, timer 1 is in a stop state and measurement data is held. when a period measurement circuit is used again, stop a period measurement circuit at once by setting the bit 2 of register w5 to 0 , and change a period measurement circuit into a state of op- eration by setting the bit 2 of register w5 to 1 again. when a period measurement circuit is used, clear bit 0 of regis- ter i1 to 0 , and set a timer 1 count start synchronous circuit to be not selected . start timer operation immediately after operation of a period measurement circuit is started. when the target edge for measurement is input until timer opera- tion is started from the operation of period measurement circuit is started, the count operation is not executed until the timer opera- tion becomes valid. accordingly, be careful of count data. when data is read from timer, stop the timer and clear bit 2 of register w5 to 0 to stop the period measurement circuit, and then execute the data read instruction. depending on the state of timer 1, the timer 1 interrupt request flag (t1f) may be set to 1 when the period measurement cir- cuit is stopped by clearing bit 2 of register w5 to 0 . in order to avoid the occurrence of an unexpected interrupt, clear the bit 2 of register v1 to 0 (refer to figure 27 ? 0 to stop the period measurement circuit. in addition, execute the snzt1 instruction to clear the t1f flag after executing at least one instruction (refer to figure 27 ? ? (8) pulse width measurement function (timer 1, period measurement circuit) a period measurement circuit can measure h pulse width (from rising to falling) or l pulse width (from falling to rising) of p3 0 / int0 pin input (pulse width measurement function) when the fol- lowing is set; set the bit 0 of register w5 to 0 , and set a bit 1 to 1 (target for period measurement circuit: 3 0 /int0 pin input). set the bit 1 of register i1 to 1 (int0 pin edge detection circuit: both edges detection) the measurement pulse width ( h or l ) is decided by the pe- riod measurement circuit and the p3 0 /int0 pin input level at the start time of timer operation. at the time of the start of a period measurement circuit and timer operation, l pulse width (from falling to rising) when the input level of p3 0 /int0 pin is h or h pulse width (from rising to fall- ing) when its level is l is measured. when the input of p3 0 /int0 pin is selected as the target for mea- surement, set the bit 3 of register i1 to 1 , and set the input of int0 pin to be enabled.
function block operations 4519 group hardware 1-40 rev.1.00 aug 06, 2004 rej09b0175-0100z (11) timer input/output pin (d 6 /cntr0 pin, d 7 /cntr1 pin) cntr0 pin is used to input the timer 1 count source and output the timer 1 and timer 2 underflow signal divided by 2. cntr1 pin is used to input the timer 3 count source and output the pwm signal generated by timer 4. the d 6 /cntr0 pin function can be selected by bit 0 of register w6. the selection of d 7 /cntr1 output signal can be controlled by bit 3 of register w4. when the cntr0 input is selected for timer 1 count source, timer 1 counts the rising or falling waveform of cntr0 input. the count edge is selected by the bit 2 of register w6. when the cntr1 input is selected for timer 3 count source, timer 3 counts the rising or falling waveform of cntr1 input. the count edge is selected by the bit 3 of register w6. (12) pwm output function (d 7 /cntr1, timer 3, timer 4) when bit 3 of register w4 is set to 1, timer 4 reloads data from re- load register r4l and r4h alternately each underflow. timer 4 generates the pwm signal (pwmout) of the l interval set as reload register r4l, and the h interval set as reload regis- ter r4h. the pwm signal (pwmout) is output from cntr1 pin. when bit 2 of register w4 is set to 1 at this time, the interval (pwm signal h interval) set to reload register r4h for the counter of timer 4 is extended for a half period of count source. in this case, when a value set in reload register r4h is n, timer 4 divides the count source signal by n + 1.5 (n = 1 to 255). when this function is used, set 1 or more to reload register r4h. when bit 1 of register w6 is set to 1, the pwm signal output to cntr1 pin is switched to valid/invalid each timer 3 underflow. however, when timer 3 is stopped (bit 2 of register w3 is cleared to 0), this function is canceled. even when bit 1 of a register w4 is cleared to 0 in the h interval of pwm signal, timer 4 does not stop until it next timer 4 underflow. at cntr1 output vaild, if a timing of timer 4 underflow overlaps with a timing to stop timer 4, a hazard may be generated in a cntr1 output waveform. please review sufficiently. (9) count start synchronization circuit (timer 1, timer 3) timer 1 and timer 3 have the count start synchronous circuit which synchronizes the input of int0 pin and int1 pin, and can start the timer count operation. timer 1 count start synchronous circuit function is selected by set- ting the bit 0 of register i1 to 1 and the control by int0 pin input can be performed. timer 3 count start synchronous circuit function is selected by set- ting the bit 0 of register i2 to 1 and the control by int1 pin input can be performed. when timer 1 or timer 3 count start synchronous circuit is used, the count start synchronous circuit is set, the count source is input to each timer by inputting valid waveform to int0 pin or int1 pin. the valid waveform of int0 pin or int1 pin to set the count start synchronous circuit is the same as the external interrupt activated condition. once set, the count start synchronous circuit is cleared by clearing the bit i1 0 or i2 0 to 0 or reset. however, when the count auto-stop circuit is selected, the count start synchronous circuit is cleared (auto-stop) at the timer 1 or timer 3 underflow. (10) count auto-stop circuit (timer 1, timer 3) timer 1 has the count auto-stop circuit which is used to stop timer 1 automatically by the timer 1 underflow when the count start syn- chronous circuit is used. the count auto-stop cicuit is valid by setting the bit 3 of register w1 to 1. it is cleared by the timer 1 underflow and the count source to timer 1 is stopped. this function is valid only when the timer 1 count start synchronous circuit is selected. timer 3 has the count auto-stop circuit which is used to stop timer 3 automatically by the timer 3 underflow when the count start syn- chronous circuit is used. the count auto-stop cicuit is valid by setting the bit 3 of register w3 to 1. it is cleared by the timer 3 underflow and the count source to timer 3 is stopped. this function is valid only when the timer 3 count start synchronous circuit is selected.
function block operations 4519 group hardware 1-41 rev.1.00 aug 06, 2004 rej09b0175-0100z (13) timer interrupt request flags (t1f, t2f, t3f, t4f) each timer interrupt request flag is set to 1 when each timer underflows. the state of these flags can be examined with the skip instructions (snzt1, snzt2, snzt3, snzt4). use the interrupt control register v1, v2 to select an interrupt or a skip instruction. an interrupt request flag is cleared to 0 when an interrupt occurs or when the next instruction is skipped with a skip instruction. the timer 1 interrupt request flag (t1f) is not set by the timer 1 under- flow signal, it is the flag for detecting the completion of period measurement. (14) precautions note the following for the use of timers. prescaler stop counting and then execute the tabps instruction to read from prescaler data. stop counting and then execute the tpsab instruction to set prescaler data. timer count source stop timer 1, 2, 3 and 4 counting to change its count source. reading the count value stop timer 1, 2, 3 or 4 counting and then execute the data read instruction (tab1, tab2, tab3, tab4) to read its data. writing to the timer stop timer 1, 2, 3 or 4 counting and then execute the data write instruction (t1ab, t2ab, t3ab, t4ab) to write its data. writing to reload register r1, r3, r4h when writing data to reload register r1, reload register r3 or re- load regiser r4h while timer 1, timer 3 or timer 4 is operating, avoid a timing when timer 1, timer 3 or timer 4 underflows. timer 4 at cntr1 output vaild, if a timing of timer 4 underflow overlaps with a timing to stop timer 4, a hazard may be generated in a cntr1 output waveform. please review sufficiently. when h interval extension function of the pwm signal is set to be valid, set 1 or more to reload register r4h. period measurement function when a period measurement circuit is used, clear bit 0 of regis- ter i1 to 0, and set a timer 1 count start synchronous circuit to be not selected. start timer operation immediately after operation of a period measurement circuit is started. when the target edge for measurement is input until timer opera- tion is started from the operation of period measurement circuit is started, the count operation is not executed until the timer opera- tion becomes valid. accordingly, be careful of count data. when data is read from timer, stop the timer and clear bit 2 of register w5 to 0 to stop the period measurement circuit, and then execute the data read instruction. depending on the state of timer 1, the timer 1 interrupt request flag (t1f) may be set to 1 when the period measurement cir- cuit is stopped by clearing bit 2 of register w5 to 0. in order to avoid the occurrence of an unexpected interrupt, clear the bit 2 of register v1 to 0 (refer to figure 28 ? ? ? ? ?? ? ? ?? ? ? ? fig. 28 period measurement circuit program example while a period measurement circuit is operating, the timer 1 in- terrupt request flag (t1f) is not set by the timer 1 underflow signal, it is the flag for detecting the completion of period mea- surement. when a period measurement circuit is used, select the suffi- ciently higher-speed frequency than the signal for measurement for the count source of a timer 1. when the target signal for period measurement is d 6 /cntr0 pin input, do not select d 6 /cntr0 pin input as timer 1 count source. (the x in input is recommended as timer 1 count source at the time of period measurement circuit use.) when the input of p3 0 /int0 pin is selected for measurement, set the bit 3 of a register i1 to 1, and set the input of int0 pin to be enabled.
function block operations 4519 group hardware 1-42 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 29 timer 4 operation (reload register r4l: ?3 16 ? r4h: ?2 16 ? 0 ) timer 4 count source timer 4 count value (reload register) 02 16 01 16 00 16 03 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 03 16 (r4l) timer 4 underflow signal pwm signal (output invalid) timer 4 start pwm signal l fixed 02 16 03 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 02 16 01 16 (r4h) pwm period 7 clock pwm period 7 clock 03 16 01 16 00 16 02 16 02 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 (r4l) (r4h) (r4l) (r4h) (r4l) (r4h) pwm period 7.5 clock pwm period 7.5 clock 1 ) pwm signal h interval extension function: invalid (w4 2 = 0 ) timer 4 count source timer 4 count value (reload register) timer 4 underflow signal pwm signal timer 4 count source timer 4 count value (reload register) timer 4 underflow signal pwm signal timer 4 start timer 4 start 1 ) pwm signal h interval extension function: valid (w4 2 = 1 ) (note) note: at pwm signal h interval extension function: valid, set 01 16 or more to reload register r4h. (r4l) (r4h) (r4l) (r4h) (r4l) (r4l) (r4l) (r4l) (r4l) 3 clock 3 clock 3.5 clock 3.5 clock
function block operations 4519 group hardware 1-43 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 30 cntr1 output auto-control function by timer 3 cntr1 output auto-control circuit by timer 3 is selected. cntr1 output register w6 1 when the cntr1 output auto-control function is set to be invalid while the cntr1 output is invalid, the cntr1 output invalid state is retained. when the cntr1 output auto-control function is set to be invalid while the cntr1 output is valid, the cntr1 output valid state is retained. when timer 3 is stopped, the cntr1 output auto-control function becomes invalid. 1 ) cntr1 output auto-control circuit selected (w6 1 = 1 ) timer 3 underflow signal pwm signal timer 3 start cntr1 output start ? ? ? ? ? ?
function block operations 4519 group hardware 1-44 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 31 timer 4 count start/stop timing (r4l) (r4h) (r4l) timer 4 count start timing waveform extension function of cntr1 output h interval: invalid (w4 2 = 0), cntr1 output: valid (w4 3 = 1), count source: x in input selected (w4 0 = 0), reload register r4l: 03 16 reload register r4h: 02 16 timer 4 count start timing tw4a instruction execution cycle (w4 1 )
function block operations 4519 group hardware 1-45 rev.1.00 aug 06, 2004 rej09b0175-0100z watchdog timer watchdog timer provides a method to reset the system when a pro- gram run-away occurs. watchdog timer consists of timer wdt(16-bit binary counter), watchdog timer enable flag (wef), and watchdog timer flags (wdf1, wdf2). the timer wdt downcounts the instruction clocks as the count source from ffff 16 after system is released from reset. after the count is started, when the timer wdt underflow occurs (after the count value of timer wdt reaches 0000 16 , the next count pulse is input), the wdf1 flag is set to 1. if the wrst instruction is never executed until the timer wdt un- derflow occurs (until timer wdt counts 65534), wdf2 flag is set to 1, and the reset pin outputs l level to reset the microcom- puter. execute the wrst instruction at each period of 65534 machine cycle or less by software when using watchdog timer to keep the microcomputer operating normally. when the wef flag is set to 1 after system is released from reset, the watchdog timer function is valid. when the dwdt instruction and the wrst instruction are ex- ecuted continuously, the wef flag is cleared to 0 and the watchdog timer function is invalid. the wef flag is set to "1" at system reset or ram back-up mode. the wrst instruction has the skip function. when the wrst in- struction is executed while the wdf1 flag is 1 , the wdf1 flag is cleared to 0 and the next instruction is skipped. when the wrst instruction is executed while the wdf1 flag is 0 , the next instruction is not skipped. the skip function of the wrst instruction can be used even when the watchdog timer function is invalid. fig. 32 watchdog timer function 6 5 5 3 4 c o u n t ( n o t e ) v a l u e o f 1 6 - b i t t i m e r ( w d t ) w d f 1 f l a g ? ? ? ? ? 1 . ? 0 , t h e n e x t i n s t r u c t i o n i s s k i p p e d . ? 1 , w d f 2 f l a g i s s e t t o 1 a n d t h e w a t c h d o g r e s e t s i g n a l i s o u t p u t . ? o n b y t h e w a t c h d o g r e s e t s i g n a l a n d s y s t e m r e s e t i s e x e c u t e d . n o t e : t h e n u m b e r o f c o u n t i s e q u a l t o t h e n u m b e r o f c y c l e b e c a u s e t h e c o u n t s o u r c e o f w a t c h d o g t i m e r i s t h e i n s t r u c t i o n c l o c k . f f f f 1 6 0 0 0 0 1 6 ? ? ?
function block operations 4519 group hardware 1-46 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 33 program example to start/stop watchdog timer fig. 34 program example to enter the mode when using the watchdog timer wrst ; wdf1 flag cleared nop di ; interrupt disabled epof ; pof instruction enabled pof when the watchdog timer is used, clear the wdf1 flag at the pe- riod of 65534 machine cycles or less with the wrst instruction. when the watchdog timer is not used, execute the dwdt instruc- tion and the wrst instruction continuously (refer to figure 33). the watchdog timer is not stopped with only the dwdt instruction. the contents of wdf1 flag and timer wdt are initialized at the ram back-up mode. when using the watchdog timer and the ram back-up mode, ini- tialize the wdf1 flag with the wrst instruction just before the microcomputer enters the ram back-up state (refer to figure 34). the watchdog timer function is valid after system is returned from the ram back-up. when not using the watchdog timer function, ex- ecute the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up, and stop the watchdog timer function. wrst ; wdf1 flag cleared di dwdt ; wat chdog timer function enabled/disabled wrst ; wef and wdf1 flags cleared
function block operations 4519 group hardware 1-47 rev.1.00 aug 06, 2004 rej09b0175-0100z v ss v dd iap4 (p4 0 p4 3 ) iap6 (p6 0 p6 3 ) op4a (p4 0 p4 3 ) op6a (p6 0 p6 3 ) tabad q1 3 q2 1 q2 0 q2 2 tadab q1 2 q1 1 q1 0 0 1 4 4 4 4 8 8 8 01 1 8 10 q1 3 q1 3 0 1 q1 3 8 8 2 tala q1 3 q2 3 taq2 tq2a taq1 tq1a adf (1) p6 0 /a in0 p4 0 /a in4 p4 1 /a in5 p4 2 /a in6 p4 3 /a in7 3 1 0 10 p6 1 /a in1 p6 2 /a in2 p6 3 /a in3 4 4 q3 1 q3 0 q3 2 q3 3 taq3 tq3a 4 (note 1) register a (4) register b (4) dac operation signal comparator 8-channel multi-plexed analog switch instruction clock a/d control circuit successive comparison register (ad) (10) a/d interrupt comparator register (8) notes 1: this switch is turned on only when a/d converter is operating and generates the comparison voltage. 2: writing/reading data to the comparator register is possible only in the comparator mode (q1 3 =1). the value of the comparator register is retained even when the mode is switched to the a/d conversion mode (q1 3 =0) because it is separated from the successive comparison register (ad). also, the resolution in the comparator mode is 8 bits because the comparator register consists of 8 bits. (note 2) 11 q3 1 , q3 0 10 01 00 0 1 q3 2 on-chip oscillator clock a/d conversion clock (adck) division circuit divided by 48 divided by 24 divided by 12 divided by 6 da converter a/d converter (comparator) the 4519 group has a built-in a/d conversion circuit that performs conversion by 10-bit successive comparison method. table 11 shows the characteristics of this a/d converter. this a/d converter can also be used as an 8-bit comparator to compare analog volt- ages input from the analog input pin with preset values. table 11 a/d converter characteristics characteristics successive comparison method 10 bits linearity error: ?lsb (2.7 v
function block operations 4519 group hardware 1-48 rev.1.00 aug 06, 2004 rej09b0175-0100z table 12 a/d control registers q1 2 0 0 0 0 1 1 1 1 a/d operation mode selection bit analog input pin selection bits q1 1 0 0 1 1 0 0 1 1 a/d control register q1 at ram back-up : state retained at reset : 0000 2 q1 3 a/d conversion mode comparator mode r/w taq1/tq1a q1 0 0 1 0 1 0 1 0 1 q1 2 q1 1 q1 0 analog input pins a in0 a in1 a in2 a in3 a in4 a in5 a in6 a in7 p4 0 , p4 1 , p4 2 , p4 3 a in4 , a in5 , a in6 , a in7 p6 2 , p6 3 a in2 , a in3 p6 1 a in1 p6 0 a in0 p4 0 /a in4 , p4 1 /a in5 , p4 2 /a in6 , p4 3 /a in7 pin function selection bit p6 2 /a in2 , p6 3 /a in3 pin function selection bit p6 1 /a in1 pin function selection bit p6 0 /a in0 pin function selection bit 0 1 0 1 0 1 0 1 q2 3 q2 2 q2 1 q2 0 r/w taq2/tq2a a/d control register q2 at ram back-up : state retained at reset : 0000 2 note: r represents read enabled, and w represents write enabled. not used a/d converter operation clock selection bit a/d converter operation clock division ratio selection bits a/d control register q3 q3 3 q3 2 q3 1 q3 0 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 q3 1 0 0 1 1 q3 0 0 1 0 1 division ratio frequency divided by 6 frequency divided by 12 frequency divided by 24 frequency divided by 48 this bit has no function, but read/write is enabled. instruction clock (instck) on-chip oscillator (f(ring)) r/w taq3/tq3a
function block operations 4519 group hardware 1-49 rev.1.00 aug 06, 2004 rej09b0175-0100z (1) a/d control register a/d control register q1 register q1 controls the selection of a/d operation mode and the selection of analog input pins. set the contents of this register through register a with the tq1a instruction. the taq1 instruc- tion can be used to transfer the contents of register q1 to register a. a/d control register q2 register q2 controls the selection of p4 0 /a in4 p4 3 /a in7 , p6 0 / a in0 p6 3 /a in3 . set the contents of this register through register a with the tq2a instruction. the taq2 instruction can be used to transfer the contents of register q2 to register a. a/d control register q3 register q3 controls the selection of a/d converter operation clock . set the contents of this register through register a with the tq3a instruction. the taq3 instruction can be used to transfer the contents of register q3 to register a. (2) operating at a/d conversion mode the a/d conversion mode is set by setting the bit 3 of register q1 to 0. (3) successive comparison register ad register ad stores the a/d conversion result of an analog input in 10-bit digital data format. the contents of the high-order 8 bits of this register can be stored in register b and register a with the tabad instruction. the contents of the low-order 2 bits of this reg- ister can be stored into the high-order 2 bits of register a with the tala instruction. however, do not execute these instructions dur- ing a/d conversion. when the contents of register ad is n, the logic value of the com- parison voltage v ref generated from the built-in d/a converter can be obtained with the reference voltage v dd by the following for- mula: logic value of comparison voltage v ref v ref = ? 1 when a/d con- version completes. the state of adf flag can be examined with the skip instruction (snzad). use the interrupt control register v2 to select the interrupt or the skip instruction. the adf flag is cleared to 0 when the interrupt occurs or when the next instruction is skipped with the skip instruction. (5) a/d conversion start instruction (adst) a/d conversion starts when the adst instruction is executed. the conversion result is automatically stored in the register ad. (6) operation description a/d conversion is started with the a/d conversion start instruction (adst). the internal operation during a/d conversion is as follows: ? 000 16 . ? 1, and the com- parison voltage v ref is compared with the analog input voltage v in . ? 1. when the comparison result is v ref > v in , it is cleared to 0. the 4519 group repeats this operation to the lowermost bit of the register ad to convert an analog value to a digital value. a/d con- version stops after 2 machine cycles + a/d conversion clock (31 1 as soon as a/d conversion completes (figure 36). table 13 change of successive comparison register ad during a/d conversion comparison voltage (v ref ) value change of successive comparison register ad at starting conversion ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ------------- ------------- ------------- ------------- ------------- ------------- ------------- -------------
function block operations 4519 group hardware 1-50 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 37 setting registers a/d control register q2 a in0 pin function selected ??? ? ? ? ? ? ? ? ? ? ?
function block operations 4519 group hardware 1-51 rev.1.00 aug 06, 2004 rej09b0175-0100z (9) operation at comparator mode the a/d converter is set to comparator mode by setting bit 3 of the register q1 to 1. below, the operation at comparator mode is described. (10) comparator register in comparator mode, the built-in d/a comparator is connected to the 8-bit comparator register as a register for setting comparison voltages. the contents of register b is stored in the high-order 4 bits of the comparator register and the contents of register a is stored in the low-order 4 bits of the comparator register with the tadab instruction. when changing from a/d conversion mode to comparator mode, the result of a/d conversion (register ad) is undefined. however, because the comparator register is separated from regis- ter ad, the value is retained even when changing from comparator mode to a/d conversion mode. note that the comparator register can be written and read at only comparator mode. if the value in the comparator register is n, the logic value of com- parison voltage v ref generated by the built-in d/a converter can be determined from the following formula: (11) comparison result store flag (adf) in comparator mode, the adf flag, which shows completion of a/d conversion, stores the results of comparing the analog input volt- age with the comparison voltage. when the analog input voltage is lower than the comparison voltage, the adf flag is set to 1. the state of adf flag can be examined with the skip instruction (snzad). use the interrupt control register v2 to select the inter- rupt or the skip instruction. the adf flag is cleared to 0 when the interrupt occurs or when the next instruction is skipped with the skip instruction. (12) comparator operation start instruction (adst instruction) in comparator mode, executing adst starts the comparator oper- ating. the comparator stops 2 machine cycles + a/d conversion clock f(adck) 1 clock after it has started (4 1. (13) notes for the use of a/d conversion tala instruction when the tala instruction is executed, the low-order 2 bits of register ad is transferred to the high-order 2 bits of register a, si- multaneously, the low-order 2 bits of register a is 0. operation mode of a/d converter do not change the operating mode (both a/d conversion mode and comparator mode) of a/d converter with the bit 3 of register q1 while the a/d converter is operating. clear the bit 2 of register v2 to 0 to change the operating mode of the a/d converter from the comparator mode to a/d conver- sion mode. the a/d conversion completion flag (adf) may be set when the operating mode of the a/d converter is changed from the com- parator mode to the a/d conversion mode. accordingly, set a value to the register q1, and execute the snzad instruction to clear the adf flag. logic value of comparison voltage v ref v ref = ?
function block operations 4519 group hardware 1-52 rev.1.00 aug 06, 2004 rej09b0175-0100z (14) definition of a/d converter accuracy the a/d conversion accuracy is defined below (refer to figure 39). relative accuracy ? 0 to 1. ? 1023 to 1022. ? ? absolute accuracy this means a deviation from the ideal characteristics between 0 to v dd of actual a/d conversion characteristics. fig. 39 definition of a/d conversion accuracy v fst v 0t 1022 v dd 1024 vn: analog input voltage when the output data changes from n to n+1 (n = 0 to 1022) 1lsb at relative accuracy 1lsb at absolute accuracy a a [lsb] actual a/d conversion characteristics a: 1lsb by relative accuracy b: v n+1 v n c: difference between ideal v n and actual v n zero transition voltage (v 0t ) analog voltage full-scale transition voltage (v fst ) ideal line of a/d conversion between v 0 v 1022
function block operations 4519 group hardware 1-53 rev.1.00 aug 06, 2004 rej09b0175-0100z serial i/o the 4519 group has a built-in clock synchronous serial i/o which can serially transmit or receive 8-bit data. serial i/o consists of; serial i/o register si serial i/o control register j1 serial i/o transmit/receive completion flag (siof) serial i/o counter registers a and b are used to perform data transfer with internal cpu, and the serial i/o pins are used for external data transfer. the pin functions of the serial i/o pins can be set with the register j1. table 14 serial i/o pins pin p2 0 /s ck p2 1 /s out p2 2 /s in pin function when selecting serial i/o clock i/o (s ck ) serial data output (s out ) serial data input (s in ) fig. 40 serial i/o structure table 15 serial i/o control register note: r represents read enabled, and w represents write enabled. note: even when the s ck , s out , s in pin functions are used, the input of p2 0 , p2 1 , p2 2 are valid. 1/8 1/4 1/2 00 01 10 11 synchronous circuit serial i/o counter (3) siof serial i/o interrupt instck p2 0 /s ck s ck qs r msb serial i/o register (8) lsb s in j1 1 j1 0 j1 3 j1 2 register b (4) register a (4) tsiab tabsi tabsi s out p2 1 /s out p2 2 /s in sst instruction internal reset signal j1 3 0 0 1 1 j1 1 0 0 1 1 serial i/o synchronous clock selection bits serial i/o port function selection bits j1 2 0 1 0 1 j1 0 0 1 0 1 serial i/o control register j1 at ram back-up : state retained at reset : 0000 2 j1 3 j1 2 j1 1 j1 0 synchronous clock instruction clock (instck) divided by 8 instruction clock (instck) divided by 4 instruction clock (instck) divided by 2 external clock (s ck input) port function p2 0 , p2 1 ,p2 2 selected/s ck , s out , s in not selected s ck , s out , p2 2 selected/p2 0 , p2 1 , s in not selected s ck , p2 1 , s in selected/p2 0 , s out , p2 2 not selected s ck , s out , s in selected/p2 0 , p2 1 ,p2 2 not selected r/w taj1/tj1a
function block operations 4519 group hardware 1-54 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 41 serial i/o register state when transferring (1) serial i/o register si serial i/o register si is the 8-bit data transfer serial/parallel conver- sion register. data can be set to register si through registers a and b with the tsiab instruction. the contents of register a is transmit- ted to the low-order 4 bits of register si, and the contents of register b is transmitted to the high-order 4 bits of register si. during transmission, each bit data is transmitted lsb first from the lowermost bit (bit 0) of register si, and during reception, each bit data is received lsb first to register si starting from the topmost bit (bit 7). when register si is used as a work register without using serial i/o, do not select the s ck pin. (2) serial i/o transmit/receive completion flag (siof) serial i/o transmit/receive completion flag (siof) is set to 1 when serial data transmission or reception completes. the state of siof flag can be examined with the skip instruction (snzsi). use the in- terrupt control register v2 to select the interrupt or the skip instruction. the siof flag is cleared to 0 when the interrupt occurs or when the next instruction is skipped with the skip instruction. (3) serial i/o start instruction (sst) when the sst instruction is executed, the siof flag is cleared to 0 and then serial i/o transmission/reception is started. (4) serial i/o control register j1 register j1 controls the synchronous clock, p2 0 /s ck , p2 1 /s out and p2 2 /s in pin function. set the contents of this register through register a with the tj1a instruction. the taj1 instruction can be used to transfer the contents of register j1 to register a. d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 at transmit (d 7 d 0 : transfer data) at receive d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 s i n p i n s o u t p i n s o u t p i n s i n p i n s e r i a l i / o r e g i s t e r ( s i ) serial i/o register (si) d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 * d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 7 d 6 d 5 d 4 d 3 d 2 d 0 d 1 d 0 transfer data set t r a n s f e r s t a r t transfer complete * * * ** ** ** * ******** ******** ** ** ** * ******
function block operations 4519 group hardware 1-55 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) how to use serial i/o figure 42 shows the serial i/o connection example. serial i/o inter- rupt is not used in this example. in the actual wiring, pull up the wiring between each pin with a resistor. figure 42 shows the data transfer timing and table 16 shows the data transfer sequence. fig. 42 serial i/o connection example s out s r d y s i g n a l s c k s in d 3 s c k s o u t s i n d 3 m a s t e r ( c l o c k c o n t r o l ) s e r i a l i / o i n t e r r u p t e n a b l e b i t ( s n z s i i n s t r u c t i o n v a l i d ) interrupt control register v2 s e r i a l i / o c o n t r o l r e g i s t e r j 1 s e r i a l i / o p o r t s c k , s o u t , s i n instruction clock/8 selected as synchronous clock s l a v e ( e x t e r n a l c l o c k ) s e r i a l i / o i n t e r r u p t e n a b l e b i t ( s n z s i i n s t r u c t i o n v a l i d ) ? ? ? ? ?? ?
function block operations 4519 group hardware 1-56 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 43 timing of serial i/o data transfer m 0 m 7 : c o n t e n t s o f m a s t e r s e r i a l i / o r e g i s t e r s 0 s 7 : c o n t e n t s o f s l a v e s e r i a l i / o r e g i s t e r r i s i n g o f s c k : s e r i a l i n p u t f a l l i n g o f s c k : s e r i a l o u t p u t s i n s o u t master s l a v e s c k s s t i n s t r u c t i o n s o u t s i n s 0 s 7 s 1 s 2 s 3 s 4 s 5 s 6 s 7 s s t i n s t r u c t i o n s r d y s i g n a l s 0 s 7 s 1 s 3 s 4 s 5 s 6 s 7 m 0 m 7 m 1 m 2 m 3 m 4 m 5 m 6 m 7 m 0 m 7 m 1 m 2 m 3 m 4 m 5 m 6 m 7 s 2
function block operations 4519 group hardware 1-57 rev.1.00 aug 06, 2004 rej09b0175-0100z table 16 processing sequence of data transfer from master to slave 1-byte data is serially transferred on this process. subsequently, data can be transferred continuously by repeating the process from *. when an external clock is selected as a synchronous clock, the clock is not controlled internally. control the clock externally be- cause serial transfer is performed as long as clock is externally input. (unlike an internal clock, an external clock is not stopped when serial transfer is completed.) however, the siof flag is set to 1 when the clock is counted 8 times after executing the sst in- struction. be sure to set the initial level of the external clock to h. master (transmission) [initial setting] setting the serial i/o mode register j1 and inter- rupt control register v2 shown in figure 42. tj1a and tv2a instructions setting the port received the reception enable signal (s rdy ) to the input mode. (port d 3 is used in this example) sd instruction * [transmission enable state] storing transmission data to serial i/o register si. tsiab instruction [transmission] check port d 3 is l level. szd instruction serial transfer starts. sst instruction check transmission completes. snzsi instruction wait (timing when continuously transferring) slave (reception) [initial setting] setting serial i/o mode register j1, and interrupt control register v2 shown in figure 42. tj1a and tv2a instructions setting the port transmitted the reception enable signal (s rdy ) and outputting h level (reception impossible). (port d 3 is used in this example) sd instruction *[reception enable state] the siof flag is cleared to 0. sst instruction l level (reception possible) is output from port d 3 . rd instruction [reception] check reception completes. snzsi instruction h level is output from port d 3 . sd instruction [data processing]
function block operations 4519 group hardware 1-58 rev.1.00 aug 06, 2004 rej09b0175-0100z reset function system reset is performed by applying l level to reset pin for 1 machine cycle or more when the following condition is satisfied; the value of supply voltage is the minimum value or more of the recommended operating conditions. then when h level is applied to reset pin, software starts from address 0 in page 0. fig. 44 reset release timing fig. 45 reset pin input waveform and reset operation f(ring) reset program starts (address 0 in page 0) on-chip oscillator (internal oscillator) is counted 120 to 144 times. note: the number of clock cycles depends on the internal state of the microcomputer when reset is performed. reset 0.3v dd 0.85v dd ( note ) note: keep the value of supply voltage to the minimum value or more of the recommended operating conditions. reset input 1 machine cycle or more = program starts (address 0 in page 0) on-chip oscillator (internal oscillator) is counted 120 to 144 times.
function block operations 4519 group hardware 1-59 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 46 structure of reset pin and its peripherals, and power-on reset operation name d 0 ? 5 d 6 /cntr0 d 7 /cntr1 p0 0 ?0 3 p1 0 ?1 3 p2 0 /s ck , p2 1 /s out , p2 2 /s in p3 0 /int0, p3 1 /int1, p3 2 , p3 3 p4 0 /a in4 ?4 3 /a in7 p5 0 ?5 3 p6 0 /a in0 ?6 3 /a in3 notes 1: output latch is set to ?. 2: output structure is n-channel open-drain. 3: pull-up transistor is turned off. function d 0 ? 5 d 6 d 7 p0 0 ?0 3 p1 0 ?1 3 p2 0 ?2 2 p3 0 ?3 3 p4 0 ?4 3 p5 0 ?5 3 p6 0 ?6 3 state high-impedance (notes 1, 2) high-impedance (notes 1, 2) high-impedance (notes 1, 2) high-impedance (notes 1, 2, 3) high-impedance (notes 1, 2, 3) high-impedance (note 1) high-impedance (note 1) high-impedance (note 1) high-impedance (notes 1, 2) high-impedance (note 1) (1) power-on reset reset can be automatically performed at power on (power-on re- set) by the built-in power-on reset circuit. when the built-in power-on reset circuit is used, the time for the supply voltage to rise from 0 v until the value of supply voltage reaches the minimum operating voltage must be set to 100 s or less. if the rising time exceeds 100 s, connect a capacitor between the reset pin and v ss at the shortest distance, and input ??level to reset pin until the value of supply voltage reaches the minimum operating voltage. table 17 port state at reset reset pin wef watchdog reset signal (note 1) pull-up transistor (note 1) power-on reset circuit voltage drop detection circuit v dd (note 3) 100 notes 1: this symbol represents a parasitic diode. 2: applied potential to reset pin must be v dd or less. 3: keep the value of supply voltage to the minimum value or more of the recommended operating conditions. power-on reset circuit output srst instruction
function block operations 4519 group hardware 1-60 rev.1.00 aug 06, 2004 rej09b0175-0100z program counter (pc) .......................................................................................................... address 0 in page 0 is set to program counter. interrupt enable flag (inte) .................................................................................................. power down flag (p) ........................................................................................................... .. external 0 interrupt request flag (exf0) .............................................................................. external 1 interrupt request flag (exf1) .............................................................................. interrupt control register v1 ................................................................................................. . interrupt control register v2 ................................................................................................. . interrupt control register i1 ................................................................................................. .. interrupt control register i2 ................................................................................................. .. timer 1 interrupt request flag (t1f) ..................................................................................... timer 2 interrupt request flag (t2f) ..................................................................................... timer 3 interrupt request flag (t3f) ..................................................................................... timer 4 interrupt request flag (t4f) ..................................................................................... watchdog timer flags (wdf1, wdf2) .................................................................................. watchdog timer enable flag (wef) ...................................................................................... timer control register pa ..................................................................................................... . timer control register w1 ..................................................................................................... timer control register w2 ..................................................................................................... timer control register w3 ..................................................................................................... timer control register w4 ..................................................................................................... timer control register w5 ..................................................................................................... timer control register w6 ..................................................................................................... clock control register mr ..................................................................................................... clock control register rg ..................................................................................................... serial i/o transmit/receive completion flag (siof) .............................................................. serial i/o mode register j1 .................................................................................................. serial i/o register si ........................................................................................................ ..... a/d conversion completion flag (adf) ................................................................................. a/d control register q1 ....................................................................................................... .. a/d control register q2 ....................................................................................................... .. a/d control register q3 ....................................................................................................... .. successive comparison register ad .................................................................................... comparator register ........................................................................................................... ... key-on wakeup control register k0 ...................................................................................... key-on wakeup control register k1 ...................................................................................... key-on wakeup control register k2 ...................................................................................... pull-up control register pu0 ................................................................................................. pull-up control register pu1 ................................................................................................. ? represents undefined. fig. 47 internal state at reset 1 (2) internal state at reset figure 47 and 48 show internal state at reset (they are the same af- ter system is released from reset). the contents of timers, registers, flags and ram except shown in figure are undefined, so set the initial value to them. 00000000000000 0 (interrupt disabled) 0 0 0 0 0 0 0 (interrupt disabled) 0 0 0 0 (interrupt disabled) 0000 0000 0 0 0 0 0 1 0 (prescaler stopped) 0 0 0 0 (timer 1 stopped) 0 0 0 0 (timer 2 stopped) 0 0 0 0 (timer 3 stopped) 0 0 0 0 (timer 4 stopped) 0000( period measurement circuit stopped ) 0000 1111 0 (on-chip oscillator operating) 0 0 0 0 0 (external clock selected, serial i/o port not selected) ?????? ?????? ?????? ?? ? ??? ??
function block operations 4519 group hardware 1-61 rev.1.00 aug 06, 2004 rej09b0175-0100z port output structure control register fr0 ........................................................................... port output structure control register fr1 ........................................................................... port output structure control register fr2 ........................................................................... port output structure control register fr3 ........................................................................... carry flag (cy) ............................................................................................................... ....... register a .................................................................................................................... ......... register b .................................................................................................................... ......... register d .................................................................................................................... ......... register e .................................................................................................................... ......... register x .................................................................................................................... ......... register y .................................................................................................................... ......... register z .................................................................................................................... ......... stack pointer (sp) ............................................................................................................ .... operation source clock .......................................................... on-chip oscillator (operating) ceramic resonator circuit .............................................................................................. stop rc oscillation circuit ...................................................................................................... stop quartz-crystal oscillation circuit .................................................................................... stop ? represents undefined. fig. 48 internal state at reset 2 ?? ??? ?????? ??
4519 group hardware 1-62 rev.1.00 aug 06, 2004 rej09b0175-0100z voltage drop detection circuit the built-in voltage drop detection circuit is designed to detect a drop in voltage and to reset the microcomputer if the supply voltage drops below a set value. fig. 49 voltage drop detection reset circuit fig. 50 voltage drop detection circuit operation waveform table 18 voltage drop detection circuit operation state vdce pin l h at cpu operating invalid valid at ram back-up invalid valid + v rst v rst + - vdce voltage drop detection circuit reset signal voltage drop detection circuit v rst (reset release voltage) + - v dd voltage drop detection circuit reset signal microcomupter starts operation after on-chip oscillator (internal oscillator) clock is counted 120 to 144 times. v rst (reset voltage) reset pin note: detection voltage hysteresis of voltage drop detection circuit is 0.2 v (typ). function block operations
4519 group hardware 1-63 rev.1.00 aug 06, 2004 rej09b0175-0100z ram back-up mode the 4519 group has the ram back-up mode. when the epof and pof instructions are executed continuously, system enters the ram back-up state. the pof instruction is equal to the nop instruction when the epof instruction is not ex- ecuted before the pof instruction. as oscillation stops retaining ram, the function of reset circuit and states at ram back-up mode, current dissipation can be reduced without losing the contents of ram. table 18 shows the function and states retained at ram back-up. figure 51 shows the state transition. (1) identification of the start condition warm start (return from the ram back-up state) or cold start (re- turn from the normal reset state) can be identified by examining the state of the ram back-up flag (p) with the snzp instruction. (2) warm start condition when the external wakeup signal is input after the system enters the ram back-up state by executing the epof and pof instruc- tions continuously, the cpu starts executing the program from address 0 in page 0. in this case, the p flag is 1. (3) cold start condition the cpu starts executing the program from address 0 in page 0 when; reset pulse is input to reset pin, or reset by watchdog timer is performed, or voltage drop detection circuit detects the voltage drop, or srst instruction is executed. in this case, the p flag is 0. table 19 functions and states retained at ram back-up function program counter (pc), registers a, b, carry flag (cy), stack pointer (sp) (note 2) contents of ram interrupt control registers v1, v2 interrupt control registers i1, i2 selection of oscillation circuit clock control register mr timer 1 function timer 2 function timer 3 function timer 4 function watchdog timer function timer control register pa, w4 timer control registers w1 to w3, w5, w6 serial i/o function serial i/o mode register j1 a/d conversion function a/d control registers q1 to q3 voltage drop detection circuit port level key-on wakeup control register k0 to k2 pull-up control registers pu0, pu1 port output direction registers fr0 to fr3 external 0 interrupt request flag (exf0) external 1 interrupt request flag (exf1) timer 1 interrupt request flag (t1f) timer 2 interrupt request flag (t2f) timer 3 interrupt request flag (t3f) timer 4 interrupt request flag (t4f) a/d conversion completion flag (adf) serial i/o transmission/reception completion flag (siof) interrupt enable flag (inte) watchdog timer flags (wdf1, wdf2) watchdog timer enable flag (wef) ram back-up ? ? ? ? ? ? ? ? ? ? ? ? ? ? o represents that the function can be retained, and ? repre- sents that the function is initialized. registers and flags other than the above are undefined at ram back-up, and set an initial value after returning. 2: the stack pointer (sp) points the level of the stack register and is initialized to 7 at ram back-up. 3: the state of the timer is undefined. 4: initialize the watchdog timer with the wrst instruction, and then execute the pof instruction. 5: the valid/invalid of the voltage drop detection circuit can be con- trolled only by vdce pin. function block operations
4519 group hardware 1-64 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) return signal an external wakeup signal is used to return from the ram back-up mode because the oscillation is stopped. table 19 shows the return condition for each return source. (5) related registers key-on wakeup control register k0 register k0 controls the ports p0 and p1 key-on wakeup func- tion. set the contents of this register through register a with the tk0a instruction. in addition, the tak0 instruction can be used to transfer the contents of register k0 to register a. key-on wakeup control register k1 register k1 controls the return condition and valid waveform/ level selection for port p0. set the contents of this register through register a with the tk1a instruction. in addition, the tak1 instruction can be used to transfer the contents of register k1 to register a. key-on wakeup control register k2 register k2 controls the int0 and int1 key-on wakeup functions and return condition function. set the contents of this register through register a with the tk2a instruction. in addition, the tak2 instruction can be used to transfer the contents of register k2 to register a. table 20 return source and return condition remarks the key-on wakeup function can be selected with 2 port units. select the re- turn level ( l level or h level), and return condition (return by level or edge) with the register k1 according to the external state before going into the ram back-up state. the key-on wakeup function can be selected with 2 port units. set the port using the key-on wakeup function to h level before going into the ram back-up state. select the return level ( l level or h level) with the registers i1 and i2 ac- cording to the external state, and return condition (return by level or edge) with the register k2 before going into the ram back-up state. return condition return by an external h level or l level input, or rising edge ( l h ) or falling edge ( h l ). return by an external l level in- put. return by an external h level or l level input, or rising edge ( l h ) or falling edge ( h l ). the external interrupt request flags (exf0, exf1) are not set. external wakeup signal return source ports p0 0 p0 3 ports p1 0 p1 3 int0 int1 pull-up control register pu0 register pu0 controls the on/off of the port p0 pull-up transis- tor. set the contents of this register through register a with the tpu0a instruction. in addition, the tapu0 instruction can be used to transfer the contents of register pu0 to register a. pull-up control register pu1 register pu1 controls the on/off of the port p1 pull-up transis- tor. set the contents of this register through register a with the tpu1a instruction. in addition, the tapu1 instruction can be used to transfer the contents of register pu0 to register a. external interrupt control register i1 register i1 controls the valid waveform of external 0 interrupt, in- put control of int0 pin, and return input level. set the contents of this register through register a with the ti1a instruction. in addi- tion, the tai1 instruction can be used to transfer the contents of register i1 to register a. external interrupt control register i2 register i2 controls the valid waveform of external 1 interrupt, in- put control of int1 pin, and return input level. set the contents of this register through register a with the ti2a instruction. in addi- tion, the tai2 instruction can be used to transfer the contents of register i2 to register a. function block operations
4519 group hardware 1-65 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 51 state transition fig. 52 set source and clear source of the p flag fig. 53 start condition identified example using the snzp in- struction a operation state operation source clock: f(ring) f(x in ): stop key-on wakeup pof instruction execution e ram back-up mode d operation source clock: f(x in ) f(ring): stop pof instruction execution operation state notes 1: microcomputer starts its operation after counting f(ring) 120 to 144 times. c pof instruction execution operation state operation source clock: f(x in ) f(ring): operating b pof instruction execution operation state operation source clock: f(ring) f(x in ): operating f(ring): stop f(x in ): stop mr 1 0 when the oscillation circuit is not selected. surely, select the f(x in ) oscillation circuit by executing the cmck, crck or cyck instruction before clearing mr 1 to 0 . the start/stop of oscillation and the operation source is switched by register mr. instruction (the start of oscillation and the operation source clock is not switched by these instructions). 2: the f(x in ) oscillation circuit (ceramic resonance, rc oscillation or quartz-crystal oscillation) is selected by the cmck, crck or cyck s r q power down flag p pof instruction reset input epof instruction + pof instruction epof instruction + program start p = 1 ? yes warm start cold start no function block operations
4519 group hardware 1-66 rev.1.00 aug 06, 2004 rej09b0175-0100z table 21 key-on wakeup control register, pull-up control register k0 3 k0 2 k0 1 k0 0 key-on wakeup control register k0 key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used pins p1 2 and p1 3 key-on wakeup control bit pins p1 0 and p1 1 key-on wakeup control bit pins p0 2 and p0 3 key-on wakeup control bit pins p0 0 and p0 1 key-on wakeup control bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak0/tk0a note: r represents read enabled, and w represents write enabled. k1 3 k1 2 k1 1 k1 0 key-on wakeup control register k1 return by level return by edge falling waveform/ l level rising waveform/ h level return by level return by edge falling waveform/ l level rising waveform/ h level ports p0 2 and p0 3 return condition selection bit ports p0 2 and p0 3 valid waveform/ level selection bit ports p0 1 and p0 0 return condition selection bit ports p0 1 and p0 0 valid waveform/ level selection bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak1/tk1a k2 3 k2 2 k2 1 k2 0 key-on wakeup control register k2 return by level return by edge key-on wakeup not used key-on wakeup used return by level return by edge key-on wakeup not used key-on wakeup used int1 pin return condition selection bit int1 pin key-on wakeup contro bit int0 pin return condition selection bit int0 pin key-on wakeup contro bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak2/tk2a function block operations
4519 group hardware 1-67 rev.1.00 aug 06, 2004 rej09b0175-0100z table 22 key-on wakeup control register, pull-up control register pu0 3 pu0 2 pu0 1 pu0 0 pull-up control register pu0 pu1 3 pu1 2 pu1 1 pu1 0 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p0 3 pin pull-up transistor control bit p0 2 pin pull-up transistor control bit p0 1 pin pull-up transistor control bit p0 0 pin pull-up transistor control bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p1 3 pin pull-up transistor control bit p1 2 pin pull-up transistor control bit p1 1 pin pull-up transistor control bit p1 0 pin pull-up transistor control bit r/w tapu0/ tpu0a pull-up control register pu1 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tapu1/ tpu1a note: r represents read enabled, and w represents write enabled. function block operations
4519 group hardware 1-68 rev.1.00 aug 06, 2004 rej09b0175-0100z clock control the clock control circuit consists of the following circuits. on-chip oscillator (internal oscillator) ceramic resonator rc oscillation circuit quartz-crystal oscillation circuit multi-plexer (clock selection circuit) frequency divider internal clock generating circuit the system clock and the instruction clock are generated as the source clock for operation by these circuits. figure 54 shows the structure of the clock control circuit. the 4519 group operates by the on-chip oscillator clock (f(ring)) which is the internal oscillator after system is released from reset. also, the ceramic resonator, the rc oscillation or quartz-crystal os- cillator can be used for the main clock (f(x in )) of the 4519 group. the cmck instruction, crck instruction or cyck instruction is ex- ecuted to select the ceramic resonator, rc oscillator or quartz-crystal oscillator respectively. fig. 54 clock control circuit structure mr 3, mr 2 00 01 10 11 cmck instruction qs r internal reset signal key-on wakeup signal epof instruction pof instruction + qs r 0 mr 0 1 division circuit system clock (stck) instruction clock (instck) multi- plexer quartz-crystal oscillation on-chip oscillator (internal oscillator) x out x in ceramic resonance rc oscillation internal clock generating circuit (divided by 3) rg 0 mr 1 qs r qs r q s r crck instruction cyck instruction divided by 2 divided by 4 divided by 8 the cmck, crck, and cyck instructions can be used only to se- lect main clock (f(x in )). in this time, the start of oscillation and the switch of system clock are not performed. the oscillation start/stop of main clock f(x in ) is controlled by bit 1 of register mr. the system clock is selected by bit 0 of register mr. the oscillation start/stop of on-chip oscillator is controlled by register rg. the oscillation circuit by the cmck, crck or cyck instruction can be selected only at once. the oscillation circuit corresponding to the first executed one of these instructions is valid. execute the main clock (f(x in )) selection instruction (cmck, crck or cyck instruction) in the initial setting routine of program (ex- ecuting it in address 0 in page 0 is recommended). when the cmck, crck, and cyck instructions are never ex- ecuted, main clock (f(x in )) cannot be used and system can be operated only by on-chip oscillator. the no operated clock source (f(ring)) or (f(x in )) cannot be used for the system clock. also, the clock source (f(ring) or f(x in )) se- lected for the system clock cannot be stopped. function block operations
4519 group hardware 1-69 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 55 switch to ceramic resonance/rc oscillation/quartz-crystal oscillation reset on-chip oscillator operation cmck instruction crckinstruction main clock: ceramic resonance on-chip oscillator: operating system clock: on-chip oscillator clock cyck instruction set the main clock (f(x in )) oscillation by bit 1 of register mr. switch the system clock by bit 0 of register mr. also, when system clock is switched after main clock oscillation is started, generate the oscillation stabilizing wait time by program if necessary. set the on-chip oscillator clock oscillation by register rg. main clock: rc oscillation circuit on-chip oscillator: operating system clock: on-chip oscillator clock main clock: quartz-crystal circuit on-chip oscillator: operating system clock: on-chip oscillator clock (1) main clock generating circuit (f(x in )) the ceramic resonator, rc oscillation or quartz-crystal oscillator can be used for the main clock of this mcu. after system is released from reset, the mcu starts operation by the clock output from the on-chip oscillator which is the internal os- cillator. when the ceramic resonator is used, execute the cmck instruc- tion. when the rc oscillation is used, execute the crck instruction. when the quartz-crystal oscillator is used, execute the cyck instruction. the oscillation start/stop of main clock f(x in ) is controlled by bit 1 of register mr. the system clock is selected by bit 0 of register mr. the oscillation circuit by the cmck, crck or cyck instruction can be selected only at once. the oscillation cir- cuit corresponding to the first executed one of these instructions is valid. execute the cmck, crck or cyck instruction in the initial setting routine of program (executing it in address 0 in page 0 is recom- mended). also, when the cmck, crck or cyck instruction is not executed in program, this mcu operates by the on-chip oscillator. function block operations
4519 group hardware 1-70 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 60 external clock input circuit fig. 59 external quartz-crystal circuit note: externally connect a damping resistor rd depending on the oscillation frequency. (a feedback resistor is built-in.) use the quartz-crystal manu- facturer? recommended value because constants such as ca- pacitance depend on the resonator. fig. 56 handling of x in and x out when operating on-chip oscillator fig. 57 ceramic resonator external circuit fig. 58 external rc oscillation circuit execute the cmck instruc- tion in program. note: externally connect a damping resistor rd depending on the oscillation frequency. (a feedback resistor is built-in.) use the resonator manu- facturer? recommended value because constants such as ca- pacitance depend on the resonator. * m34519 x in x out * do not use the cmck, crck and cyck instructions in program. open open m34519 x in x out rd c in c out m34519 x in x out r c * execute the crck instruction in program. open m34519 x in x out rd c in c out execute the cyck instruction in program. * m34519 x in x out external oscillation circuit v dd v ss r 1k ? or more open (2) on-chip oscillator operation when the mcu operates by the on-chip oscillator as the main clock (f(x in )) without using the ceramic resonator, rc oscillator or quartz-crystal oscillation, leave x in pin and x out pin open (figure 56). the clock frequency of the on-chip oscillator depends on the sup- ply voltage and the operation temperature range. be careful that the margin of frequencies when designing applica- tion products. (3) ceramic resonator when the ceramic resonator is used as the main clock (f(x in )), connect the ceramic resonator and the external circuit to pins x in and x out at the shortest distance. then, execute the cmck in- struction. a feedback resistor is built in between pins x in and x out (figure 57). (4) rc oscillation when the rc oscillation is used as the main clock (f(x in )), connect the x in pin to the external circuit of resistor r and the capacitor c at the shortest distance and leave x out pin open. then, execute the crck instruction (figure 58). the frequency is affected by a capacitor, a resistor and a micro- computer. so, set the constants within the range of the frequency limits. (5) quartz-crystal oscillator when a quartz-crystal oscillator is used as the main clock (f(x in )), connect this external circuit and a quartz-crystal oscillator to pins x in and x out at the shortest distance. then, execute the cyck in- struction. a feedback resistor is built in between pins x in and x out (figure 59). (6) external clock when the external clock signal for the main clock (f(x in )) is used, connect the clock source to x in pin and x out pin open. in program, after the cmck instruction is executed, set main clock (f(x in )) os- cillation start to be enabled (mr 1 =0). for this product, when ram back-up mode and main clock (f(x in )) stop (mr 1 =1), x in pin is fixed to h in order to avoid the through current by floating of internal logic. the x in pin is fixed to h until main clock (f(x in )) oscillation starts to be valid (mr 1 =0) by the cmck instruction from reset state. accordingly, when an external clock is used, connect a 1 k ? or more resistor to x in pin in series to limit of current by competitive signal. execute the cmck instruction in program, and set the main clock f(x in ) to be enabled (mr 1 =0) * function block operations
4519 group hardware 1-71 rev.1.00 aug 06, 2004 rej09b0175-0100z rom ordering method 1.mask rom order confirmation form ? ? ? renesas technology corp. homepage (http://www.renesas.com/en/rom). (7) clock control register mr register mr controls system clock. set the contents of this register through register a with the tmra instruction. in addition, the tamr instruction can be used to transfer the contents of register mr to register a. table 23 clock control registers note: r represents read enabled, and w represents write enabled. mr 3 clock control register mr operation mode through mode (frequency not divided) frequency divided by 2 mode frequency divided by 4 mode frequency divided by 8 mode main clock (f(x in )) oscillation enabled main clock (f(x in )) oscillation stop main clock (f(x in )) main clock (f(ring)) at reset : 1111 2 at ram back-up : 1111 2 mr 3 0 0 1 1 r/w tamr/ tmra main clock f(x in ) oscillation circuit control bit system clock oscillation source selection bit operation mode selection bits 0 1 0 1 mr 2 0 1 0 1 mr 1 mr 0 mr 2 0 1 on-chip oscillator (f(ring)) oscillation enabled on-chip oscillator (f(ring)) oscillation stop on-chip oscillator (f(ring)) control bit clock control register rg w trga at ram back-up : 0 2 at reset : 0 2 rg 0 (8) clock control register rg register rg controls start/stop of on-chip oscillator. set the con- tents of this register through register a with the trga instruction. function block operations
4519 group hardware 1-72 rev.1.00 aug 06, 2004 rej09b0175-0100z ? ? the input/output of p3 0 and p3 1 can be used even when int0 and int1 are selected. the input of ports p2 0 p2 2 can be used even when s in , s out and s ck are selected. the input/output of d 6 can be used even when cntr0 (input) is selected. the input of d 6 can be used even when cntr0 (output) is selected. the input/output of d 7 can be used even when cntr1 (input) is selected. the input of d 7 can be used even when cntr1 (output) is selected. 10 11 12 ? ? ? ? h interval extension function of the pwm signal is set to be valid , set 1 or more to reload register r4h. watchdog timer the watchdog timer function is valid after system is released from reset. when not using the watchdog timer function, execute the dwdt instruction and the wrst instruction continuously, and clear the wef flag to 0 to stop the watchdog timer function. the watchdog timer function is valid after system is returned from the ram back-up state. when not using the watchdog timer func- tion, execute the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up state, and stop the watchdog timer function. when the watchdog timer function and ram back-up function are used at the same time, execute the wrst instruction before sys- tem enters into the ram back-up state and initialize the flag wdf1. list of precautions ? connect a bypass capacitor (approx. 0.1 equalize its wiring in width and length, and use relatively thick wire. in the one time prom version, cnv ss pin is also used as v pp pin. accordingly, when using this pin, connect this pin to v ss through a resistor about 5 k ? ? register z (2 bits) register d (3 bits) register e (8 bits) ? register z (2 bits) register x (4 bits) register y (4 bits) register d (3 bits) register e (8 bits) list of precautions
4519 group hardware 1-73 rev.1.00 aug 06, 2004 rej09b0175-0100z la 0 ; ( ? ?? ? ? ?? ? ? ? 13 period measurement circuit when a period measurement circuit is used, clear bit 0 of regis- ter i1 to 0 , and set a timer 1 count start synchronous circuit to be not selected . start timer operation immediately after operation of a period measurement circuit is started. when the edge for measurement is input until timer operation is started from the operation of period measurement circuit is started, the count operation is not executed until the timer opera- tion becomes valid. accordingly, be careful of count data. when data is read from timer, stop the timer and clear bit 2 of register w5 to 0 to stop the period measurement circuit, and then execute the data read instruction. depending on the state of timer 1, the timer 1 interrupt request flag (t1f) may be set to 1 when the period measurement cir- cuit is stopped by clearing bit 2 of register w5 to 0 . in order to avoid the occurrence of an unexpected interrupt, clear the bit 2 of register v1 to 0 (refer to figure 61 ? 0 to stop the period measurement circuit. in addition, execute the snzt1 instruction to clear the t1f flag after executing at least one instruction (refer to figure 61 ? ? 1 , and set the input of int0 pin to be enabled. list of precautions
4519 group hardware 1-74 rev.1.00 aug 06, 2004 rej09b0175-0100z p3 0 /int0 pin ? note [1] on bit 3 of register i1 when the input of the int0 pin is controlled with the bit 3 of reg- ister i1 in software, be careful about the following notes. ?depending on the input state of the p3 0 /int0 pin, the external 0 interrupt request flag (exf0) may be set when the bit 3 of regis- ter i1 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 0 of register v1 to ??(refer to figure 61 ? ) and then, change the bit 3 of register i1. in addition, execute the snz0 instruction to clear the exf0 flag to ??after executing at least one instruction (refer to figure 62 ? ). also, set the nop instruction for the case when a skip is per- formed with the snz0 instruction (refer to figure 62 ? ). la 4 ; ( ??? 0 2 ) tv1a ; the snz0 instruction is valid ........... ? la 8 ; (1 ??? 2 ) ti1a ; control of int0 pin input is changed nop ........................................................... ? snz0 ; the snz0 instruction is executed (exf0 flag cleared) nop ........................................................... ? ? : these bits are not used here. ? note [2] on bit 3 of register i1 when the bit 3 of register i1 is cleared to ?? the ram back-up mode is selected and the input of int0 pin is disabled, be careful about the following notes. ?when the input of int0 pin is disabled (register i1 3 = ??, set the key-on wakeup function to be invalid (register k2 0 = ?? before system enters to the ram back-up mode. (refer to figure 63 ? ). la 0 ; ( ??? 0 2 ) tk2a ; input of int0 key-on wakeup invalid .. ? di epof pof ; ram back-up ? : these bits are not used here. fig. 63 external 0 interrupt program example-2 ? note on bit 2 of register i1 when the interrupt valid waveform of the p3 0 /int0 pin is changed with the bit 2 of register i1 in software, be careful about the following notes. ?depending on the input state of the p3 0 /int0 pin, the external 0 interrupt request flag (exf0) may be set when the bit 2 of regis- ter i1 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 0 of register v1 to ??(refer to figure 64 ? ) and then, change the bit 2 of register i1. in addition, execute the snz0 instruction to clear the exf0 flag to ??after executing at least one instruction (refer to figure 64 ? ). also, set the nop instruction for the case when a skip is per- formed with the snz0 instruction (refer to figure 64 ? ). la 4 ; ( ??? 0 2 ) tv1a ; the snz0 instruction is valid ........... ? la 12 ; ( ? 1 ?? 2 ) ti1a ; interrupt valid waveform is changed nop ........................................................... ? snz0 ; the snz0 instruction is executed (exf0 flag cleared) nop ........................................................... ? ? : these bits are not used here. fig. 64 external 0 interrupt program example-3 14 fig. 62 external 0 interrupt program example-1 list of precautions
4519 group hardware 1-75 rev.1.00 aug 06, 2004 rej09b0175-0100z p3 1 /int1 pin ? note [1] on bit 3 of register i2 when the input of the int1 pin is controlled with the bit 3 of reg- ister i2 in software, be careful about the following notes. ?depending on the input state of the p3 1 /int1 pin, the external 1 interrupt request flag (exf1) may be set when the bit 3 of regis- ter i2 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 1 of register v1 to ??(refer to figure 65 ? ) and then, change the bit 3 of register i2. in addition, execute the snz1 instruction to clear the exf1 flag to ??after executing at least one instruction (refer to figure 65 ? ). also, set the nop instruction for the case when a skip is per- formed with the snz1 instruction (refer to figure 65 ? ). la 4 ; ( ?? 0 ? 2 ) tv1a ; the snz1 instruction is valid ........... ? la 8 ; (1 ??? 2 ) ti2a ; control of int1 pin input is changed nop ........................................................... ? snz1 ; the snz1 instruction is executed (exf1 flag cleared) nop ........................................................... ? ? : these bits are not used here. fig. 65 external 1 interrupt program example-1 ? note [2] on bit 3 of register i2 when the bit 3 of register i2 is cleared to ?? the ram back-up mode is selected and the input of int1 pin is disabled, be careful about the following notes. ?when the input of int1 pin is disabled (register i2 3 = ??, set the key-on wakeup function to be invalid (register k2 2 = ?? before system enters to the ram back-up mode. (refer to figure 66 ? ). la 0 ; ( ? 0 ?? 2 ) tk2a ; input of int1 key-on wakeup invalid .. ? di epof pof ; ram back-up ? : these bits are not used here. fig. 66 external 1 interrupt program example-2 ? note on bit 2 of register i2 when the interrupt valid waveform of the p3 1 /int1 pin is changed with the bit 2 of register i2 in software, be careful about the following notes. ?depending on the input state of the p3 1 /int1 pin, the external 1 interrupt request flag (exf1) may be set when the bit 2 of regis- ter i2 is changed. in order to avoid the occurrence of an unexpected interrupt, clear the bit 1 of register v1 to ??(refer to figure 67 ? ) and then, change the bit 2 of register i2. in addition, execute the snz1 instruction to clear the exf1 flag to ??after executing at least one instruction (refer to figure 67 ? ). also, set the nop instruction for the case when a skip is per- formed with the snz1 instruction (refer to figure 67 ? ). la 4 ; ( ?? 0 ? 2 ) tv1a ; the snz1 instruction is valid ........... ? la 12 ; ( ? 1 ?? 2 ) ti2a ; interrupt valid waveform is changed nop ........................................................... ? snz1 ; the snz1 instruction is executed (exf1 flag cleared) nop ........................................................... ? ? : these bits are not used here. fig. 67 external 1 interrupt program example-3 15 list of precautions
4519 group hardware 1-76 rev.1.00 aug 06, 2004 rej09b0175-0100z pof instruction when the pof instruction is executed continuously after the epof instruction, system enters the ram back-up state. note that system cannot enter the ram back-up state when ex- ecuting only the pof instruction. be sure to disable interrupts by executing the di instruction be- fore executing the epof instruction and the pof instruction continuously. program counter make sure that the pc does not specify after the last page of the built-in rom. power-on reset when the built-in power-on reset circuit is used, the time for the supply voltage to rise from 0 v to the value of supply voltage or more must be set to 100 l level to reset pin until the value of supply voltage reaches the minimum operating voltage. clock control execute the main clock (f(x in )) selection instruction (cmck, crck or cyck instruction) in the initial setting routine of pro- gram (executing it in address 0 in page 0 is recommended). the oscillation circuit by the cmck, crck or cyck instruction can be selected only at once. the oscillation circuit correspond- ing to the first executed one of these instructions is valid. the cmck, crck, and cyck instructions can be used only to select main clock (f(x in )). in this time, the start of oscillation and the switch of system clock are not performed. when the cmck, crck, and cyck instructions are never ex- ecuted, main clock (f(x in )) cannot be used and system can be operated only by on-chip oscillator. the no operated clock source (f(ring)) or (f(x in )) cannot be used for the system clock. also, the clock source (f(ring) or f(x in )) selected for the system clock cannot be stopped. on-chip oscillator the clock frequency of the on-chip oscillator depends on the sup- ply voltage and the operation temperature range. be careful that variable frequencies when designing application products. when considering the oscillation stabilize wait time at the switch of clock, be careful that the margin of frequencies of the on-chip oscillator clock. 18 20 21 22 a/d converter-1 when the tala instruction is executed, the low-order 2 bits of register ad is transferred to the high-order 2 bits of register a, si- multaneously, the low-order 2 bits of register a is 0. do not change the operating mode (both a/d conversion mode and comparator mode) of a/d converter with the bit 3 of register q1 while the a/d converter is operating. clear the bit 2 of register v2 to 0 to change the operating mode of the a/d converter from the comparator mode to a/d conversion mode. the a/d conversion completion flag (adf) may be set when the operating mode of the a/d converter is changed from the com- parator mode to the a/d conversion mode. accordingly, set a value to the register q1, and execute the snzad instruction to clear the adf flag. la 8 ; ( ? ?? ? ??? ? fig. 69 analog input external circuit example-1 a/d converter-2 each analog input pin is equipped with a capacitor which is used to compare the analog voltage. accordingly, when the analog volt- age is input from the circuit with high-impedance and, charge/ discharge noise is generated and the sufficient a/d accuracy may not be obtained. therefore, reduce the impedance or, connect a capacitor (0.01 ?
4519 group hardware 1-77 rev.1.00 aug 06, 2004 rej09b0175-0100z external clock when the external clock signal for the main clock (f(x in )) is used, connect the clock source to x in pin and x out pin open. in pro- gram, after the cmck instruction is executed, set main clock (f(x in )) oscillation start to be enabled (mr 1 =0). for this product, when ram back-up mode and main clock (f(x in )) stop (mr 1 =1), x in pin is fixed to h in order to avoid the through current by floating of internal logic. the x in pin is fixed to h until main clock (f(x in )) oscillation start to be valid (mr 1 =0) by the cmck instruction from reset state. accordingly, when an external clock is used, connect a 1 k ?
4519 group hardware 1-78 rev.1.00 aug 06, 2004 rej09b0175-0100z control registers i1 3 i1 2 i1 1 i1 0 int0 pin input control bit (note 2) interrupt valid waveform for int0 pin/ return level selection bit (note 2) int0 pin edge detection circuit control bit int0 pin timer 1 count start synchronous circuit selection bit interrupt control register i1 r/w tai1/ti1a at ram back-up : state retained at reset : 0000 2 int0 pin input disabled int0 pin input enabled falling waveform/ l level ( l level is recognized with the snzi0 instruction) rising waveform/ h level ( h level is recognized with the snzi0 instruction) one-sided edge detected both edges detected timer 1 count start synchronous circuit not selected timer 1 count start synchronous circuit selected 0 1 0 1 0 1 0 1 interrupt disabled (snzsi instruction is valid) interrupt enabled (snzsi instruction is invalid) interrupt disabled (snzad instruction is valid) interrupt enabled (snzad instruction is invalid) interrupt disabled (snzt4 instruction is valid) interrupt enabled (snzt4 instruction is invalid) interrupt disabled (snzt3 instruction is valid) interrupt enabled (snzt3 instruction is invalid) v1 3 v1 2 v1 1 v1 0 v2 3 v2 2 v2 1 v2 0 serial i/o interrupt enable bit a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit interrupt control register v2 at ram back-up : 0000 2 at reset : 0000 2 0 1 0 1 0 1 0 1 interrupt control register v1 timer 2 interrupt enable bit timer 1 interrupt enable bit external 1 interrupt enable bit external 0 interrupt enable bit interrupt disabled (snzt2 instruction is valid) interrupt enabled (snzt2 instruction is invalid) interrupt disabled (snzt1 instruction is valid) interrupt enabled (snzt1 instruction is invalid) interrupt disabled (snz1 instruction is valid) interrupt enabled (snz1 instruction is invalid) interrupt disabled (snz0 instruction is valid) interrupt enabled (snz0 instruction is invalid) 0 1 0 1 0 1 0 1 at ram back-up : 0000 2 at reset : 0000 2 r/w tav1/tv1a i2 3 i2 2 i2 1 i2 0 int1 pin input control bit (note 2) interrupt valid waveform for int1 pin/ return level selection bit (note 2) int1 pin edge detection circuit control bit int1 pin timer 3 count start synchronous circuit selection bit interrupt control register i2 r/w tai2/ti2a at ram back-up : state retained at reset : 0000 2 int1 pin input disabled int1 pin input enabled falling waveform/ l level ( l level is recognized with the snzi1 instruction) rising waveform/ h level ( h level is recognized with the snzi1 instruction) one-sided edge detected both edges detected timer 3 count start synchronous circuit not selected timer 3 count start synchronous circuit selected 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i1 2 , i1 3 i2 2 and i2 3 are changed, the external interrupt request flag (exf0, exf1) may be set to 1 . r/w tav2/tv2a control registers
4519 group hardware 1-79 rev.1.00 aug 06, 2004 rej09b0175-0100z w2 1 0 0 1 1 timer 1 underflow signal divided by 2 output timer 2 underflow signal divided by 2 output stop (state retained) operating count source system clock (stck) prescaler output (orclk) timer 1 underflow signal (t1udf) pwm signal (pwmout) cntr0 output signal selection bit timer 2 control bit timer 2 count source selection bits 0 1 0 1 w2 0 0 1 0 1 timer control register w2 at ram back-up : state retained at reset : 0000 2 notes 1: r represents read enabled, and w represents write enabled. 2: this function is valid only when the timer 1 count start synchronous circuit is selected (i1 0 = 1 ). w2 3 w2 2 w2 1 w2 0 mr 3 clock control register mr operation mode through mode (frequency not divided) frequency divided by 2 mode frequency divided by 4 mode frequency divided by 8 mode main clock (f(x in )) oscillation enabled main clock (f(x in )) oscillation stop main clock (f(x in )) main clock (f(ring)) at reset : 1111 2 at ram back-up : 1111 2 mr 3 0 0 1 1 r/w tamr/ tmra main clock f(x in ) oscillation circuit control bit system clock oscillation source selection bit operation mode selection bits 0 1 0 1 mr 2 0 1 0 1 mr 1 mr 0 mr 2 0 1 on-chip oscillator (f(ring)) oscillation enabled on-chip oscillator (f(ring)) oscillation stop on-chip oscillator (f(ring)) control bit clock control register rg w trga at ram back-up : 0 2 at reset : 0 2 rg 0 w1 1 0 0 1 1 timer 1 count auto-stop circuit not selected timer 1 count auto-stop circuit selected stop (state retained) operating count source instruction clock (instck) prescaler output (orclk) x in input cntr0 input timer 1 count auto-stop circuit selection bit (note 2) timer 1 control bit timer 1 count source selection bits 0 1 0 1 w1 0 0 1 0 1 timer control register w1 r/w taw1/tw1a at ram back-up : state retained at reset : 0000 2 w1 3 w1 2 w1 1 w1 0 r/w taw2/tw2a 0 1 stop (state initialized) operating prescaler control bit timer control register pa w tpaa at ram back-up : 0 2 at reset : 0 2 pa 0 control registers
4519 group hardware 1-80 rev.1.00 aug 06, 2004 rej09b0175-0100z falling edge rising edge falling edge rising edge cntr1 output auto-control circuit not selected cntr1 output auto-control circuit selected d 6 (i/o) / cntr0 (input) cntr0 (i/o) /d 6 (input) cntr1 pin input count edge selection bit cntr0 pin input count edge selection bit cntr1 output auto-control circuit selection bit d 6 /cntr0 pin function selection bit 0 1 0 1 0 1 0 1 timer control register w6 at ram back-up : state retained at reset : 0000 2 w6 3 w6 2 w6 1 w6 0 d 7 (i/o) / cntr1 (input) cntr1 (i/o) / d 7 (input) pwm signal h interval expansion function invalid pwm signal h interval expansion function valid stop (state retained) operating x in input prescaler output (orclk) divided by 2 d 7 /cntr1 pin function selection bit pwm signal h interval expansion function control bit timer 4 control bit timer 4 count source selection bit 0 1 0 1 0 1 0 1 w4 3 w4 2 w4 1 w4 0 w5 1 0 0 1 1 not used period measurement circuit control bit signal for period measurement selection bits 0 1 0 1 w5 0 0 1 0 1 timer control register w5 at ram back-up : state retained at reset : 0000 2 w5 3 w5 2 w5 1 w5 0 this bit has no function, but read/write is enabled. stop operating count source on-chip oscillator (f(ring/16)) cntr 0 pin input int0 pin input not available r/w taw4/tw4a timer control register w4 at ram back-up : 0000 2 at reset : 0000 2 r/w taw5/tw5a r/w taw6/tw6a w3 1 0 0 1 1 timer 3 count auto-stop circuit not selected timer 3 count auto-stop circuit selected stop (state retained) operating count source pwm signal (pwmout) prescaler output (orclk) timer 2 underflow signal (t2udf) cntr1 input timer 3 count auto-stop circuit selection bit (note 2) timer 3 control bit timer 3 count source selection bits 0 1 0 1 w3 0 0 1 0 1 timer control register w3 at ram back-up : state retained at reset : 0000 2 w3 3 w3 2 w3 1 w3 0 r/w taw3/tw3a notes 1: r represents read enabled, and w represents write enabled. 2: this function is valid only when the timer 3 count start synchronous circuit is selected (i2 0 = 1 ). control registers
4519 group hardware 1-81 rev.1.00 aug 06, 2004 rej09b0175-0100z j1 3 0 0 1 1 j1 1 0 0 1 1 serial i/o synchronous clock selection bits serial i/o port function selection bits j1 2 0 1 0 1 j1 0 0 1 0 1 serial i/o control register j1 at ram back-up : state retained at reset : 0000 2 j1 3 j1 2 j1 1 j1 0 synchronous clock instruction clock (instck) divided by 8 instruction clock (instck) divided by 4 instruction clock (instck) divided by 2 external clock (s ck input) port function p2 0 , p2 1 ,p2 2 selected/s ck , s out , s in not selected s ck , s out , p2 2 selected/p2 0 , p2 1 , s in not selected s ck , p2 1 , s in selected/p2 0 , s out , p2 2 not selected s ck , s out , s in selected/p2 0 , p2 1 ,p2 2 not selected r/w taj1/tj1a q1 2 0 0 0 0 1 1 1 1 a/d operation mode selection bit analog input pin selection bits q1 1 0 0 1 1 0 0 1 1 a/d control register q1 at ram back-up : state retained at reset : 0000 2 q1 3 a/d conversion mode comparator mode r/w taq1/tq1a q1 0 0 1 0 1 0 1 0 1 q1 2 q1 1 q1 0 analog input pins a in0 a in1 a in2 a in3 a in4 a in5 a in6 a in7 p4 0 , p4 1 , p4 2 , p4 3 a in4 , a in5 , a in6 , a in7 p6 2 , p6 3 a in2 , a in3 p6 1 a in1 p6 0 a in0 p4 0 /a in4 , p4 1 /a in5 , p4 2 /a in6 , p4 3 /a in7 pin function selection bit p6 2 /a in2 , p6 3 /a in3 pin function selection bit p6 1 /a in1 pin function selection bit p6 0 /a in0 pin function selection bit 0 1 0 1 0 1 0 1 q2 3 q2 2 q2 1 q2 0 r/w taq2/tq2a a/d control register q2 at ram back-up : state retained at reset : 0000 2 note: r represents read enabled, and w represents write enabled. not used a/d converter operation clock selection bit a/d converter operation clock division ratio selection bits a/d control register q3 q3 3 q3 2 q3 1 q3 0 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 q3 1 0 0 1 1 q3 0 0 1 0 1 division ratio frequency divided by 6 frequency divided by 12 frequency divided by 24 frequency divided by 48 this bit has no function, but read/write is enabled. instruction clock (instck) on-chip oscillator (f(ring)) r/w taq3/tq3a control registers
4519 group hardware 1-82 rev.1.00 aug 06, 2004 rej09b0175-0100z k0 3 k0 2 k0 1 k0 0 key-on wakeup control register k0 key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used pins p1 2 and p1 3 key-on wakeup control bit pins p1 0 and p1 1 key-on wakeup control bit pins p0 2 and p0 3 key-on wakeup control bit pins p0 0 and p0 1 key-on wakeup control bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak0/tk0a note: r represents read enabled, and w represents write enabled. k1 3 k1 2 k1 1 k1 0 key-on wakeup control register k1 return by level return by edge falling waveform/ l level rising waveform/ h level return by level return by edge falling waveform/ l level rising waveform/ h level ports p0 2 and p0 3 return condition selection bit ports p0 2 and p0 3 valid waveform/ level selection bit ports p0 1 and p0 0 return condition selection bit ports p0 1 and p0 0 valid waveform/ level selection bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak1/tk1a k2 3 k2 2 k2 1 k2 0 key-on wakeup control register k2 return by level return by edge key-on wakeup not used key-on wakeup used return by level return by edge key-on wakeup not used key-on wakeup used int1 pin return condition selection bit int1 pin key-on wakeup contro bit int0 pin return condition selection bit int0 pin key-on wakeup contro bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tak2/tk2a control registers
4519 group hardware 1-83 rev.1.00 aug 06, 2004 rej09b0175-0100z pu0 3 pu0 2 pu0 1 pu0 0 pull-up control register pu0 pu1 3 pu1 2 pu1 1 pu1 0 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p0 3 pin pull-up transistor control bit p0 2 pin pull-up transistor control bit p0 1 pin pull-up transistor control bit p0 0 pin pull-up transistor control bit at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p1 3 pin pull-up transistor control bit p1 2 pin pull-up transistor control bit p1 1 pin pull-up transistor control bit p1 0 pin pull-up transistor control bit r/w tapu0/ tpu0a pull-up control register pu1 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 r/w tapu1/ tpu1a note: r represents read enabled, and w represents write enabled. control registers
4519 group hardware 1-84 rev.1.00 aug 06, 2004 rej09b0175-0100z fr0 3 fr0 2 fr0 1 fr0 0 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output ports p1 2 , p1 3 output structure selection bit ports p1 0 , p1 1 output structure selection bit ports p0 2 , p0 3 output structure selection bit ports p0 0 , p0 1 output structure selection bit port output structure control register fr0 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 fr1 3 fr1 2 fr1 1 fr1 0 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port d 3 output structure selection bit port d 2 output structure selection bit port d 1 output structure selection bit port d 0 output structure selection bit port output structure control register fr1 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 fr2 3 fr2 2 fr2 1 fr2 0 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port d 7 /cntr1 output structure selection bit port d 6 /cntr0 output structure selection bit port d 5 output structure selection bit port d 4 output structure selection bit port output structure control register fr2 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 note: r represents read enabled, and w represents write enabled. w tfr0a w tfr1a w tfr2a fr3 3 fr3 2 fr3 1 fr3 0 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port p5 3 output structure selection bit port p5 2 output structure selection bit port p5 1 output structure selection bit port p5 0 output structure selection bit port output structure control register fr3 at reset : 0000 2 at ram back-up : state retained 0 1 0 1 0 1 0 1 w tfr3a control registers
4519 group hardware 1-85 rev.1.00 aug 06, 2004 rej09b0175-0100z symbol a b dr e v1 v2 i1 i2 mr rg pa w1 w2 w3 w4 w5 w6 j1 q1 q2 q3 pu0 pu1 fr0 fr1 fr2 fr3 k0 k1 k2 x y z dp pc pc h pc l sk sp cy rps r1 r2 r3 r4l r4h contents register a (4 bits) register b (4 bits) register dr (3 bits) register e (8 bits) interrupt control register v1 (4 bits) interrupt control register v2 (4 bits) interrupt control register i1 (4 bits) interrupt control register i2 (4 bits) clock control register mr (4 bits) clock control register rg (1 bit) timer control register pa (1 bit) timer control register w1 (4 bits) timer control register w2 (4 bits) timer control register w3 (4 bits) timer control register w4 (4 bits) timer control register w5 (4 bits) timer control register w6 (4 bits) serial i/o control register j1 (4 bits) a/d control register q1 (4 bits) a/d control register q2 (4 bits) a/d control register q3 (4 bits) pull-up control register pu0 (4 bits) pull-up control register pu1 (4 bits) port output format control register fr0 (4 bits) port output format control register fr1 (4 bits) port output format control register fr2 (4 bits) port output format control register fr3 (4 bits) key-on wakeup control register k0 (4 bits) key-on wakeup control register k1 (4 bits) key-on wakeup control register k2 (4 bits) register x (4 bits) register y (4 bits) register z (2 bits) data pointer (10 bits) (it consists of registers x, y, and z) program counter (14 bits) high-order 7 bits of program counter low-order 7 bits of program counter stack register (14 bits ? ? contents of registers and memories negate, flag unchanged after executing instruction ram address pointed by the data pointer label indicating address a 6 a 5 a 4 a 3 a 2 a 1 a 0 label indicating address a 6 a 5 a 4 a 3 a 2 a 1 a 0 in page p 5 p 4 p 3 p 2 p 1 p 0 hex. c + hex. number x symbol ps t1 t2 t3 t4 t1f t2f t3f t4f wdf1 wef inte exf0 exf1 p adf siof d p0 p1 p2 p3 p4 p5 p6 x y z p n i j a 3 a 2 a 1 a 0 ? m(dp) a p, a c + x instructions the 4519 group has the 153 instructions. each instruction is de- scribed as follows; (1) index list of instruction function (2) machine instructions (index by alphabet) (3) machine instructions (index by function) (4) instruction code table note : some instructions of the 4519 group has the skip function to unexecute the next described instruction. the 4519 group jus t invalidates the next instruc- tion when a skip is performed. the contents of program counter is not increased by 2. accordingly, the number of cycles does no t change even if skip is not performed. however, the cycle count becomes 1 if the tabp p, rt, or rts instruction is skipped. symbol the symbols shown below are used in the following list of instruc- tion function and the machine instructions. instructions
4519 group hardware 1-86 rev.1.00 aug 06, 2004 rej09b0175-0100z index list of instruction function group- ing ram addresses mnemonic xami j tma j la n tabp p am amc a n and or sc rc szc cma rar function (a) dr 0 , a 3 a 0 ) (dr 2 ) 4 (a) 0 (pc) 1 (a) e 4 ) e 0 ) e 4 ) (a) e 0 ) (dr 2 dr 0 ) a 0 ) (a 2 a 0 ) dr 0 ) (a 3 ) a 0 ) sp 0 ) (a 3 ) 1 (a) 1 ram to register transfer arithmetic operation ram to register transfer register to register transfer group- ing page 110, 130 119, 130 119, 130 128, 130 120, 130 111, 130 119, 130 112, 130 119, 130 118, 130 116, 130 98, 130 98, 130 98, 130 95, 130 114, 130 128, 130 128, 130 page 129, 130 122, 130 98, 132 111, 132 91, 132 91, 132 91, 132 92, 132 101, 132 103, 132 102, 132 108, 132 94, 132 101, 132 note: p is 0 to 47 for m34519m6, p is 0 to 63 for m34519m8/e8. index of instruction function
4519 group hardware 1-87 rev.1.00 aug 06, 2004 rej09b0175-0100z index list of instruction function (continued) group- ing function (mj(dp)) a 0 (pc h ) a 0 (pc h ) dr 0 , a 3 a 0 ) (sp) a 0 (sp) a 0 (sp) dr 0 , a 3 a 0 ) (pc) 1 (pc) 1 (pc) 1 comparison operation subroutine operation branch operation bit operation return operation mnemonic sb j rb j szb j seam sea n b a bl p, a bla p bm a bml p, a bmla p rti rt rts group- ing page 103, 132 101, 132 107, 132 104, 132 104, 132 92, 134 92, 134 92, 134 93, 134 93, 134 93, 134 102, 134 102, 134 103, 134 function (inte) h ? i1 2 = 0 : (int0) = l ? i2 2 = 1 : (int1) = h ? i2 2 = 0 : (int1) = l ? (a)
4519 group hardware 1-88 rev.1.00 aug 06, 2004 rej09b0175-0100z index list of instruction function (continued) group- ing group- ing function (a) tps 4 ) (a) tps 0 ) (rps 7 rps 4 ) tps 4 ) rps 0 ) tps 0 ) t1 4 ) (a) t1 0 ) (r1 7 r1 4 ) t1 4 ) r1 0 ) t1 0 ) t2 4 ) (a) t2 0 ) (r2 7 r2 4 ) t2 4 ) r2 0 ) t2 0 ) t3 4 ) (a) t3 0 ) (r3 7 r3 4 ) t3 4 ) r3 0 ) t3 0 ) t4 4 ) (a) t4 0 ) (r4l 7 r4l 4 ) t4 4 ) r4l 0 ) t4 0 ) r4h 4 ) r4h 0 ) r1 4 ) r1 0 ) r3 4 ) r3 0 ) t4 4 ) r4l 4 ) v1 2 = 0: (t1f) = 1 ? after skipping, (t1f) a 0 ) p2 0 ) (a 3 ) p2 0 ) a 0 ) (a)
4519 group hardware 1-89 rev.1.00 aug 06, 2004 rej09b0175-0100z index list of instruction function (continued) group- ing group- ing page 93, 140 102, 140 103, 140 108, 140 115, 140 123, 140 115, 140 124, 140 113, 142 122, 142 114, 142 122, 142 114, 142 122, 142 120, 142 120, 142 120, 142 121, 142 94, 142 94, 142 94, 142 125, 142 110, 142 123, 142 page 112, 142 125, 142 107, 142 106, 142 113, 142 121, 142 111, 144 114, 144 112, 144 91, 144 105, 144 115, 144 124, 144 116, 144 124, 144 116, 144 124, 144 a/d operation serial i/o operation input/output operation function (d) si 4 ) (a) si 0 ) (si 7 si 4 ) si 0 ) ad 6 ) (a) ad 2 ) in comparator mode, (b) ad 4 ) (a) ad 0 ) (a 3 , a 2 ) ad 4 ) ad 0 )
4519 group hardware 1-90 rev.1.00 aug 06, 2004 rej09b0175-0100z mnemonic nop pof epof snzp dwdt wrst srst function (pc)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-91 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by alphabet) a n (add n and accumulator) 000110nnnn 06n 11 overflow = 0 grouping: arithmetic operation description: adds the value n in the immediate field to register a, and stores a result in register a. the contents of carry flag cy remains unchanged. skips the next instruction when there is no overflow as the result of operation. executes the next instruction when there is overflow as the result of operation. operation: (a) grouping: a/d conversion operation description: clears (0) to a/d conversion completion flag adf, and the a/d conversion at the a/d conversion mode (q1 3 = 0) or the compara- tor operation at the comparator mode (q1 3 = 1) is started. operation: (adf) grouping: arithmetic operation description: adds the contents of m(dp) to register a. stores the result in register a. the contents of carry flag cy remains unchanged. operation: (a) grouping: arithmetic operation description: adds the contents of m(dp) and carry flag cy to register a. stores the result in regis- ter a and carry flag cy. operation: (a)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-92 rev.1.00 aug 06, 2004 rej09b0175-0100z and (logical and between accumulator and memory) 0000011000 018 11 grouping: arithmetic operation description: takes the and operation between the con- tents of register a and the contents of m(dp), and stores the result in register a. operation: (a) grouping: branch operation description: branch within a page : branches to address a in the identical page. note: specify the branch address within the page including this instruction. operation: (pc l ) grouping: branch operation description: branch out of a page : branches to address a in page p. note: p is 0 to 47 for m34519m6 and p is 0 to 63 for m34519m8e8. operation: (pc h ) grouping: branch operation description: branch out of a page : branches to address (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 specified by registers d and a in page p. note: p is 0 to 47 for m34519m6 and p is 0 to 63 for m34519m8e8. 8 +a 2 16 10p 5 a 6 a 5 a 4 a 3 a 2 a 1 a 0 2a e +p operation: (pc h ) dr 0 , a 3 a 0 ) 2 16 10p 5 p 4 00p 3 p 2 p 1 p 0 2pp machine instructions (index by alphabet) (continued) p +a
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-93 rev.1.00 aug 06, 2004 rej09b0175-0100z bm a (branch and mark to address a in page 2) 010a 6 a 5 a 4 a 3 a 2 a 1 a 0 1aa 11 grouping: subroutine call operation description: call the subroutine in page 2 : calls the subroutine at address a in page 2. note: subroutine extending from page 2 to an- other page can also be called with the bm instruction when it starts on page 2. be careful not to over the stack because the maximum level of subroutine nesting is 8. operation: (sp) a 0 bml p, a (branch and mark long to address a in page p) 00110p 4 p 3 p 2 p 1 p 0 0p 22 grouping: subroutine call operation description: call the subroutine : calls the subroutine at address a in page p. note: p is 0 to 47 for m34519m6 and p is 0 to 63 for m34519m8e8. be careful not to over the stack because the maximum level of subroutine nesting is 8. operation: (sp) a 0 bmla p (branch and mark long to address (d) + (a) in page p) 0000110000 030 22 grouping: subroutine call operation description: call the subroutine : calls the subroutine at address (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 speci- fied by registers d and a in page p. note: p is 0 to 47 for m34519m6 and p is 0 to 63 for m34519m8e8. be careful not to over the stack because the maximum level of subroutine nesting is 8. cld (clear port d) 0000010001 011 11 grouping: input/output operation description: sets (1) to port d. operation: (d) dr 0 , a 3 a 0 ) 2 16 10p 5 p 4 00p 3 p 2 p 1 p 0 2pp machine instructions (index by alphabet) (continued) p +a
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-94 rev.1.00 aug 06, 2004 rej09b0175-0100z cma (complement of accumulator) 0000011100 01c 11 grouping: arithmetic operation description: stores the one s complement for register a s contents in register a. operation: (a) grouping: clock control operation description: selects the ceramic oscillation circuit for main clock f(x in ). operation: ceramic oscillation circuit selected crck (clock select: rc oscillation clock) 1010011011 29b 11 grouping: clock control operation description: selects the rc oscillation circuit for main clock f(x in ). operation: rc oscillation circuit selected machine instructions (index by alphabet) (continued) cyck (clock select: crystal oscillation clock) 1010011101 29d 11 grouping: clock control operation description: selects the quartz-crystal oscillation circuit for main clock f(x in ). operation: quartz-crystal oscillation circuit selected
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-95 rev.1.00 aug 06, 2004 rej09b0175-0100z di (disable interrupt) 0000000100 004 11 grouping: interrupt control operation description: clears (0) to interrupt enable flag inte, and disables the interrupt. note: interrupt is disabled by executing the di in- struction after executing 1 machine cycle. operation: (inte) grouping: other operation description: stops the watchdog timer function by the wrst instruction after executing the dwdt instruction. operation: stop of watchdog timer function enabled ei (enable interrupt) 0000000101 005 11 grouping: interrupt control operation description: sets (1) to interrupt enable flag inte, and enables the interrupt. note: interrupt is enabled by executing the ei in- struction after executing 1 machine cycle. operation: (inte) (y) = 15 grouping: ram addresses description: subtracts 1 from the contents of register y. as a result of subtraction, when the con- tents of register y is 15, the next instruction is skipped. when the contents of register y is not 15, the next instruction is executed. operation: (y) 1 dey (decrement register y)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-96 rev.1.00 aug 06, 2004 rej09b0175-0100z iap0 (input accumulator from port p0) 1001100000 260 11 grouping: input/output operation description: transfers the input of port p0 to register a. iap1 (input accumulator from port p1) 1001100001 261 11 grouping: input/output operation description: transfers the input of port p1 to register a. operation: (a) grouping: input/output operation description: transfers the input of port p2 to register a. operation: (a 2 a 0 ) p2 0 ) (a 3 ) grouping: other operation description: makes the immediate after pof instruction valid by executing the epof instruction. operation: pof instruction valid epof (enable pof instruction)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-97 rev.1.00 aug 06, 2004 rej09b0175-0100z iap4 (input accumulator from port p4) 1001100100 264 11 grouping: input/output operation description: transfers the input of port p4 to register a. operation: (a) grouping: input/output operation description: transfers the input of port p3 to register a. operation: (a) grouping: input/output operation description: transfers the input of port p6 to register a. operation: (a) grouping: input/output operation description: transfers the input of port p5 to register a. operation: (a)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-98 rev.1.00 aug 06, 2004 rej09b0175-0100z lz z (load register z with z) 00010010z 1 z 0 04 11 grouping: ram addresses description: loads the value z in the immediate field to register z. operation: (z) continuous description grouping: ram addresses description: loads the value x in the immediate field to register x, and the value y in the immediate field to register y. when the lxy instruc- tions are continuously coded and executed, only the first lxy instruction is executed and other lxy instructions coded continu- ously are skipped. operation: (x) (y) = 0 grouping: ram addresses description: adds 1 to the contents of register y. as a re- sult of addition, when the contents of register y is 0, the next instruction is skipped. when the contents of register y is not 0, the next instruction is executed. operation: (y) continuous description grouping: arithmetic operation description: loads the value n in the immediate field to register a. when the la instructions are continuously coded and executed, only the first la in- struction is executed and other la instructions coded continuously are skipped. operation: (a)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-99 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by alphabet) (continued) nop (no operation) 0000000000 000 11 grouping: other operation description: no operation; adds 1 to program counter value, and others remain unchanged. operation: (pc) grouping: input/output operation description: outputs the contents of register a to port p0. operation: (p0) grouping: input/output operation description: outputs the contents of register a to port p1. operation: (p1) grouping: input/output operation description: outputs the contents of register a to port p2. operation: (p2)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-100 rev.1.00 aug 06, 2004 rej09b0175-0100z op4a (output port p4 from accumulator) 1000100100 224 11 grouping: input/output operation description: outputs the contents of register a to port p4. operation: (p4) grouping: input/output operation description: outputs the contents of register a to port p3. operation: (p3) grouping: input/output operation description: outputs the contents of register a to port p5. operation: (p5) grouping: input/output operation description: outputs the contents of register a to port p6. operation: (p6)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-101 rev.1.00 aug 06, 2004 rej09b0175-0100z pof (power off) 0000000010 002 11 grouping: other operation description: puts the system in ram back-up state by executing the pof instruction after execut- ing the epof instruction. note: if the epof instruction is not executed before executing this instruction, this instruction is equivalent to the nop instruction. operation: transition to ram back-up mode rar (rotate accumulator right) 0000011101 01d 1 1 0/1 grouping: arithmetic operation description: rotates 1 bit of the contents of register a in- cluding the contents of carry flag cy to the right. operation: grouping: bit operation description: clears (0) the contents of bit j (bit specified by the value j in the immediate field) of m(dp). operation: (mj(dp)) grouping: arithmetic operation description: takes the or operation between the con- tents of register a and the contents of m(dp), and stores the result in register a. operation: (a)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-102 rev.1.00 aug 06, 2004 rej09b0175-0100z rd (reset port d specified by register y) 0000010100 014 11 grouping: input/output operation description: clears (0) to a bit of port d specified by reg- ister y. operation: (d(y)) grouping: arithmetic operation description: clears (0) to carry flag cy. operation: (cy) grouping: return operation description: returns from interrupt service routine to main routine. returns each value of data pointer (x, y, z), carry flag, skip status, nop mode status by the continuous description of the la/lxy in- struction, register a and register b to the states just before interrupt. operation: (pc) 1 rt (return from subroutine) 0001000100 044 12 grouping: return operation description: returns from subroutine to the routine called the subroutine. operation: (pc) 1 machine instructions (index by alphabet) (continued)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-103 rev.1.00 aug 06, 2004 rej09b0175-0100z sd (set port d specified by register y) 0000010101 015 11 grouping: input/output operation description: sets (1) to a bit of port d specified by regis- ter y. operation: (d(y)) grouping: arithmetic operation description: sets (1) to carry flag cy. operation: (cy) skip at uncondition grouping: return operation description: returns from subroutine to the routine called the subroutine, and skips the next in- struction at uncondition. operation: (pc) 1 sb j (set bit) 00010111j j 05 11 grouping: bit operation description: sets (1) the contents of bit j (bit specified by the value j in the immediate field) of m(dp). operation: (mj(dp))
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-104 rev.1.00 aug 06, 2004 rej09b0175-0100z snz0 (skip if non zero condition of external 0 interrupt request flag) 0000111000 038 11 v1 0 = 0: (exf0) = 1 grouping: interrupt operation description: when v1 0 = 0 : skips the next instruction when external 0 interrupt request flag exf0 is 1. after skipping, clears (0) to the exf0 flag. when the exf0 flag is 0, executes the next instruction. when v1 0 = 1 : this instruction is equiva- lent to the nop instruction. operation: v1 0 = 0: (exf0) = 1 ? after skipping, (exf0) (a) = n grouping: comparison operation description: skips the next instruction when the con- tents of register a is equal to the value n in the immediate field. executes the next instruction when the con- tents of register a is not equal to the value n in the immediate field. operation: (a) = n ? n = 0 to 15 2 16 000111nnnn 07n seam (skip equal, accumulator with memory) 0000100110 026 11 (a) = (m(dp)) grouping: comparison operation description: skips the next instruction when the con- tents of register a is equal to the contents of m(dp). executes the next instruction when the con- tents of register a is not equal to the contents of m(dp). operation: (a) = (m(dp)) ? snz1 (skip if non zero condition of external 1 interrupt request flag) 0000111001 039 11 v1 1 = 0: (exf1) = 1 grouping: interrupt operation description: when v1 1 = 0 : skips the next instruction when external 1 interrupt request flag exf1 is 1. after skipping, clears (0) to the exf1 flag. when the exf1 flag is 0, executes the next instruction. when v1 1 = 1 : this instruction is equiva- lent to the nop instruction. operation: v1 1 = 0: (exf1) = 1 ? after skipping, (exf1)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-105 rev.1.00 aug 06, 2004 rej09b0175-0100z snzp (skip if non zero condition of power down flag) 0000000011 003 11 (p) = 1 grouping: other operation description: skips the next instruction when the p flag is 1 . after skipping, the p flag remains un- changed. executes the next instruction when the p flag is 0. operation: (p) = 1 ? snzad (skip if non zero condition of a/d conversion completion flag) 1010000111 287 11 v2 2 = 0: (adf) = 1 grouping: a/d conversion operation description: when v2 2 = 0 : skips the next instruction when a/d conversion completion flag adf is 1. after skipping, clears (0) to the adf flag. when the adf flag is 0, executes the next instruction. when v2 2 = 1 : this instruction is equiva- lent to the nop instruction. operation: v2 2 = 0: (adf) = 1 ? after skipping, (adf) i1 2 = 0 : (int0) = l i1 2 = 1 : (int0) = h grouping: interrupt operation description: when i1 2 = 0 : skips the next instruction when the level of int0 pin is l. executes the next instruction when the level of int0 pin is h. when i1 2 = 1 : skips the next instruction when the level of int0 pin is h. executes the next instruction when the level of int0 pin is l. operation: i1 2 = 0 : (int0) = l ? i1 2 = 1 : (int0) = h ? (i1 2 : bit 2 of the interrupt control register i1) snzi1 (skip if non zero condition of external 1 interrupt input pin) 0000111011 03b 11 i2 2 = 0 : (int1) = l i2 2 = 1 : (int1) = h grouping: interrupt operation description: when i2 2 = 0 : skips the next instruction when the level of int1 pin is l. executes the next instruction when the level of int1 pin is h. when i2 2 = 1 : skips the next instruction when the level of int1 pin is h. executes the next instruction when the level of int1 pin is l. operation: i2 2 = 0 : (int1) = l ? i2 2 = 1 : (int1) = h ? (i2 2 : bit 2 of the interrupt control register i2) machine instructions (index by alphabet) (continued)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-106 rev.1.00 aug 06, 2004 rej09b0175-0100z snzt1 (skip if non zero condition of timer 1 interrupt request flag) 1010000000 280 11 v1 2 = 0: (t1f) = 1 grouping: timer operation description: when v1 2 = 0 : skips the next instruction when timer 1 interrupt request flag t1f is 1. after skipping, clears (0) to the t1f flag. when the t1f flag is 0, executes the next instruction. when v1 2 = 1 : this instruction is equiva- lent to the nop instruction. operation: v1 2 = 0: (t1f) = 1 ? after skipping, (t1f) v1 3 = 0: (t2f) = 1 grouping: timer operation description: when v1 3 = 0 : skips the next instruction when timer 2 interrupt request flag t2f is 1. after skipping, clears (0) to the t2f flag. when the t2f flag is 0, executes the next instruction. when v1 3 = 1 : this instruction is equiva- lent to the nop instruction. operation: v1 3 = 0: (t2f) = 1 ? after skipping, (t2f) v2 0 = 0: (t3f) = 1 grouping: timer operation description: when v2 0 = 0 : skips the next instruction when timer 3 interrupt request flag t3f is 1. after skipping, clears (0) to the t3f flag. when the t3f flag is 0, executes the next instruction. when v2 0 = 1 : this instruction is equiva- lent to the nop instruction. operation: v2 0 = 0: (t3f) = 1 ? after skipping, (t3f) v2 3 = 0: (siof) = 1 grouping: serial i/o operation description: when v2 3 = 0 : skips the next instruction when serial i/o interrupt request flag siof is 1. after skipping, clears (0) to the siof flag. when the siof flag is 0, executes the next instruction. when v2 3 = 1 : this instruction is equiva- lent to the nop instruction. operation: v2 3 = 0: (siof) = 1 ? after skipping, (siof)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-107 rev.1.00 aug 06, 2004 rej09b0175-0100z snzt4 (skip if non zero condition of timer 4 inerrupt request flag) srst (system reset) sst (serial i/o transmission/reception start) 1010000011 283 11 v2 1 = 0: (t4f) = 1 grouping: timer operation description: when v2 1 = 0 : skips the next instruction when timer 4 interrupt request flag t4f is 1. after skipping, clears (0) to the t4f flag. when the t4f flag is 0, executes the next instruction. when v2 1 = 1 : this instruction is equiva- lent to the nop instruction. operation: v2 1 = 0: (t4f) = 1 ? after skipping, (t4f) grouping: other operation description: system reset occurs. operation: system reset occurrence 1010011110 29e 11 grouping: serial i/o operation description: clears (0) to siof flag and starts serial i/o. operation: (siof) (mj(dp)) = 0 j = 0 to 3 grouping: bit operation description: skips the next instruction when the con- tents of bit j (bit specified by the value j in the immediate field) of m(dp) is 0. executes the next instruction when the con- tents of bit j of m(dp) is 1. operation: (mj(dp)) = 0 ? j = 0 to 3
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-108 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by alphabet) (continued) szc (skip if zero, carry flag) 0000101111 02f 11 (cy) = 0 grouping: arithmetic operation description: skips the next instruction when the con- tents of carry flag cy is 0. after skipping, the cy flag remains un- changed. executes the next instruction when the con- tents of the cy flag is 1. operation: (cy) = 0 ? szd (skip if zero, port d specified by register y) 0000100100 024 22 (d(y)) = 0 (y) = 0 to 7 grouping: input/output operation description: skips the next instruction when a bit of port d specified by register y is 0. executes the next instruction when the bit is 1. t1ab (transfer data to timer 1 and register r1 from accumulator and register b) 1000110000 230 11 grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of timer 1 and timer 1 re- load register r1. transfers the contents of register a to the low-order 4 bits of timer 1 and timer 1 reload register r1. operation: (t1 7 t1 4 ) r1 4 ) t1 0 ) r1 0 ) grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of timer 2 and timer 2 re- load register r2. transfers the contents of register a to the low-order 4 bits of timer 2 and timer 2 reload register r2. operation: (t2 7 t2 4 ) r2 4 ) t2 0 ) r2 0 )
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-109 rev.1.00 aug 06, 2004 rej09b0175-0100z t3ab (transfer data to timer 3 and register r3 from accumulator and register b) t4ab (transfer data to timer 4 and register r4l from accumulator and register b) t4hab (transfer data to register r4h from accumulator and register b) 1000110010 232 11 grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of timer 3 and timer 3 re- load register r3. transfers the contents of register a to the low-order 4 bits of timer 3 and timer 3 reload register r3. operation: (t3 7 t3 4 ) r3 4 ) t3 0 ) r3 0 ) grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of timer 4 and timer 4 re- load register r4l. transfers the contents of register a to the low-order 4 bits of timer 4 and timer 4 reload register r4l. operation: (t4 7 t4 4 ) r4l 4 ) t4 0 ) r4l 0 ) grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of timer 4 and timer 4 re- load register r4h. transfers the contents of register a to the low-order 4 bits of timer 4 and timer 4 reload register r4h. operation: (r4h 7 r4h 4 ) r4h 0 ) grouping: timer operation description: transfers the contents of reload register r4l to timer 4. operation: (t4 7 t4 4 ) r4l 4 ) (t4 3 t4 0 ) r4l 0 )
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-110 rev.1.00 aug 06, 2004 rej09b0175-0100z tab (transfer data to accumulator from register b) 0000011110 01e 11 grouping: register to register transfer description: transfers the contents of register b to reg- ister a. tab1 (transfer data to accumulator and register b from timer 1) 1001110000 270 11 grouping: timer operation description: transfers the high-order 4 bits (t1 7 t1 4 ) of timer 1 to register b. transfers the low-order 4 bits (t1 3 t1 0 ) of timer 1 to register a. operation: (b) t1 4 ) (a) t1 0 ) tab2 (transfer data to accumulator and register b from timer 2) 1001110001 271 11 grouping: timer operation description: transfers the high-order 4 bits (t2 7 t2 4 ) of timer 2 to register b. transfers the low-order 4 bits (t2 3 t2 0 ) of timer 2 to register a. operation: (b) t2 4 ) (a) t2 0 ) operation: (a) grouping: timer operation description: transfers the high-order 4 bits (t3 7 t3 4 ) of timer 3 to register b. transfers the low-order 4 bits (t3 3 t3 0 ) of timer 3 to register a. operation: (b) t3 4 ) (a) t3 0 )
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-111 rev.1.00 aug 06, 2004 rej09b0175-0100z tabp p (transfer data to accumulator and register b from program memory in page p) 0010p 5 p 4 p 3 p 2 p 1 p 0 0p 13 grouping: arithmetic operation operation: (sp) dr 0 , a 3 a 0 ) (dr 2 ) 4 (a) 0 (pc) 1 8 +p description: transfers bits 9 and 8 to register d, bits 7 to 4 to register b and bits 3 to 0 to register a. these bits 7 to 0 are the rom pattern in ad- dress (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 specified by registers a and d in page p. note: p is 0 to 47 for m34519m6, and p is 0 to 63 for m34519m8e8. when this instruction is executed, be careful not to over the stack because 1 stage of stack register is used. tabe (transfer data to accumulator and register b from register e) 0000101010 02a 11 grouping: register to register transfer description: transfers the high-order 4 bits (e 7 e 4 ) of register e to register b, and low-order 4 bits of register e to register a. operation: (b) e 4 ) (a) e 0 ) tabad (transfer data to accumulator and register b from register ad) 1001111001 279 11 grouping: a/d conversion operation description: in the a/d conversion mode (q1 3 = 0), trans- fers the high-order 4 bits (ad 9 ad 6 ) of register ad to register b, and the middle-or- der 4 bits (ad 5 ad 2 ) of register ad to register a. in the comparator mode (q1 3 = 1), transfers the middle-order 4 bits (ad 7 ad 4 ) of register ad to register b, and the low-order 4 bits (ad 3 ad 0 ) of register ad to register a. operation: in a/d conversion mode (q1 3 = 0), (b) ad 6 ) (a) ad 2 ) in comparator mode (q1 3 = 1), (b) ad 4 ) (a) ad 0 ) (q1 3 : bit 3 of a/d control register q1) tab4 (transfer data to accumulator and register b from timer 4) 1001110011 273 11 grouping: timer operation description: transfers the high-order 4 bits (t4 7 t4 4 ) of timer 4 to register b. transfers the low-order 4 bits (t4 3 t4 0 ) of timer 4 to register a. operation: (b) t4 4 ) (a) t4 0 ) machine instructions (index by alphabet) (continued)
skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 skip condition number of cycles number of words instruction code d 9 d 0 flag cy 2 16 hardware machine instructions (index by alphabet) 4519 group 1-112 rev.1.00 aug 06, 2004 rej09b0175-0100z tad (transfer data to accumulator from register d) 0001010001 051 11 grouping: register to register transfer description: transfers the contents of register d to the low-order 3 bits (a 2 a 0 ) of register a. note: when this instruction is executed, 0 is stored to the bit 3 (a 3 ) of register a. operation: (a 2 a 0 ) dr 0 ) (a 3 ) grouping: serial i/o operation description: transfers the high-order 4 bits (si 7 si 4 ) of serial i/o register si to register b, and transfers the low-order 4 bits (si 3 si 0 ) of serial i/o register si to register a. operation: (b) si 4 ) (a) si 0 ) 1001110101 275 11 grouping: timer operation description: transfers the high-order 4 bits (tps 7 tps 4 ) of prescaler to register b, and transfers the low-order 4 bits (tps 3 tps 0 ) of prescaler to register a. operation: (b) tps 4 ) (a) tps 0 ) tadab (transfer data to register ad from accumulator from register b) 1000111001 239 11 grouping: a/d conversion operation description: in the a/d conversion mode (q1 3 = 0), this in- struction is equivalent to the nop instruction. in the comparator mode (q1 3 = 1), trans- fers the contents of register b to the high-order 4 bits (ad 7 ad 4 ) of comparator register, and the contents of register a to the low-order 4 bits (ad 3 ad 0 ) of compara- tor register. (q1 3 = bit 3 of a/d control register q1) operation: (ad 7 ad 4 ) ad 0 )
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-113 rev.1.00 aug 06, 2004 rej09b0175-0100z tai1 (transfer data to accumulator from register i1) 1001010011 253 11 grouping: interrupt operation description: transfers the contents of interrupt control register i1 to register a. operation: (a) grouping: interrupt operation description: transfers the contents of interrupt control register i2 to register a. operation: (a) grouping: input/output operation description: transfers the contents of key-on wakeup control register k0 to register a. operation: (a) grouping: serial i/o operation description: transfers the contents of serial i/o control register j1 to register a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-114 rev.1.00 aug 06, 2004 rej09b0175-0100z tak1 (transfer data to accumulator from register k1) 1001011001 259 11 grouping: input/output operation description: transfers the contents of key-on wakeup control register k1 to register a. operation: (a) grouping: input/output operation description: transfers the contents of key-on wakeup control register k2 to register a. operation: (a) grouping: a/d conversion operation description: transfers the low-order 2 bits (ad 1 , ad 0 ) of register ad to the high-order 2 bits (a 3 , a 2 ) of register a. note: after this instruction is executed, 0 is stored to the low-order 2 bits (a 1 , a 0 ) of register a. operation: (a 3 , a 2 ) grouping: ram to register transfer description: after transferring the contents of m(dp) to register a, an exclusive or operation is performed between register x and the value j in the immediate field, and stores the re- sult in register x. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-115 rev.1.00 aug 06, 2004 rej09b0175-0100z taq1 (transfer data to accumulator from register q1) 1001000100 244 11 grouping: a/d conversion operation description: transfers the contents of a/d control regis- ter q1 to register a. operation: (a) grouping: input/output operation description: transfers the contents of pull-up control register pu0 to register a. operation: (a) grouping: input/output operation description: transfers the contents of pull-up control register pu1 to register a. operation: (a) grouping: clock operation description: transfers the contents of clock control reg- ister mr to register a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-116 rev.1.00 aug 06, 2004 rej09b0175-0100z tasp (transfer data to accumulator from stack pointer) 0001010000 050 11 grouping: register to register transfer description: transfers the contents of stack pointer (sp) to the low-order 3 bits (a 2 a 0 ) of register a. note: after this instruction is executed, 0 is stored to the bit 3 (a 3 ) of register a. tav1 (transfer data to accumulator from register v1) 0001010100 054 11 grouping: interrupt operation description: transfers the contents of interrupt control register v1 to register a. operation: (a) a 0 ) sp 0 ) (a 3 ) grouping: a/d conversion operation description: transfers the contents of a/d control regis- ter q3 to register a. operation: (a) grouping: a/d conversion operation description: transfers the contents of a/d control regis- ter q2 to register a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-117 rev.1.00 aug 06, 2004 rej09b0175-0100z taw2 (transfer data to accumulator from register w2) 1001001100 24c 11 grouping: timer operation description: transfers the contents of timer control reg- ister w2 to register a. operation: (a) grouping: timer operation description: transfers the contents of timer control reg- ister w1 to register a. operation: (a) grouping: timer operation description: transfers the contents of timer control reg- ister w3 to register a. operation: (a) grouping: interrupt operation description: transfers the contents of interrupt control register v2 to register a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-118 rev.1.00 aug 06, 2004 rej09b0175-0100z taw5 (transfer data to accumulator from register w5) taw6 (transfer data to accumulator from register w6) 1001010000 250 11 grouping: timer operation description: transfers the contents of timer control reg- ister w6 to register a. tax (transfer data to accumulator from register x) 0001010010 052 11 grouping: register to register transfer description: transfers the contents of register x to reg- ister a. operation: (a) grouping: timer operation description: transfers the contents of timer control reg- ister w5 to register a. operation: (a) grouping: timer operation description: transfers the contents of timer control reg- ister w4 to register a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-119 rev.1.00 aug 06, 2004 rej09b0175-0100z tba (transfer data to register b from accumulator) 0000001110 00e 11 grouping: register to register transfer description: transfers the contents of register a to regis- ter b. tda (transfer data to register d from accumulator) 0000101001 029 11 grouping: register to register transfer description: transfers the contents of the low-order 3 bits (a 2 a 0 ) of register a to register d. operation: (dr 2 dr 0 ) a 0 ) operation: (b) grouping: register to register transfer description: transfers the contents of register z to the low-order 2 bits (a 1 , a 0 ) of register a. note: after this instruction is executed, 0 is stored to the high-order 2 bits (a 3 , a 2 ) of register a. operation: (a 1 , a 0 ) grouping: register to register transfer description: transfers the contents of register y to regis- ter a. operation: (a)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-120 rev.1.00 aug 06, 2004 rej09b0175-0100z tfr2a (transfer data to register fr2 from accumulator) tfr1a (transfer data to register fr1 from accumulator) tfr0a (transfer data to register fr0 from accumulator) 1000101000 228 11 grouping: input/output operation description: transfers the contents of register a to the port output structure control register fr0. operation: (fr0) grouping: input/output operation description: transfers the contents of register a to the port output structure control register fr1. operation: (fr1) grouping: input/output operation description: transfers the contents of register a to the port output structure control register fr2. operation: (fr2) grouping: register to register transfer description: transfers the contents of register b to the high-order 4 bits (e 7 e 4 ) of register e, and the contents of register a to the low-order 4 bits (e 3 e 0 ) of register e. operation: (e 7 e 4 ) e 0 )
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-121 rev.1.00 aug 06, 2004 rej09b0175-0100z ti1a (transfer data to register i1 from accumulator) 1000010111 217 11 grouping: interrupt operation description: transfers the contents of register a to inter- rupt control register i1. operation: (i1) grouping: interrupt operation description: transfers the contents of register a to inter- rupt control register i2. operation: (i2) grouping: serial i/o operation description: transfers the contents of register a to serial i/o control register j1. operation: (j1) grouping: input/output operation description: transfers the contents of register a to the port output structure control register fr3. operation: (fr3)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-122 rev.1.00 aug 06, 2004 rej09b0175-0100z tk0a (transfer data to register k0 from accumulator) 1000011011 21b 11 grouping: input/output operation description: transfers the contents of register a to key- on wakeup control register k0. operation: (k0) grouping: input/output operation description: transfers the contents of register a to key- on wakeup control register k1. tk2a (transfer data to register k2 from accumulator) 1000010101 215 11 grouping: input/output operation description: transfers the contents of register a to key- on wakeup control register k2. operation: (k2) grouping: ram to register transfer description: after transferring the contents of register a to m(dp), an exclusive or operation is per- formed between register x and the value j in the immediate field, and stores the result in register x. operation: (m(dp))
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-123 rev.1.00 aug 06, 2004 rej09b0175-0100z tpu0a (transfer data to register pu0 from accumulator) 1000101101 22d 11 grouping: input/output operation description: transfers the contents of register a to pull- up control register pu0. operation: (pu0) grouping: timer operation description: transfers the contents of lowermost bit (a 0 ) register a to timer control register pa. operation: (pa 0 ) grouping: timer operation description: transfers the contents of register b to the high-order 4 bits of prescaler and prescaler reload register rps, and transfers the con- tents of register a to the low-order 4 bits of prescaler and prescaler reload register rps. operation: (rps 7 rps 4 ) tps 4 ) rps 0 ) tps 0 ) grouping: other operation description: transfers the contents of register a to clock control register mr. operation: (mr)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-124 rev.1.00 aug 06, 2004 rej09b0175-0100z tq2a (transfer data to register q2 from accumulator) machine instructions (index by alphabet) (continued) tq1a (transfer data to register q1 from accumulator) 1000000100 204 11 grouping: a/d conversion operation description: transfers the contents of register a to a/d control register q1. operation: (q1) grouping: a/d conversion operation description: transfers the contents of register a to a/d control register q2. operation: (q2) grouping: a/d conversion operation description: transfers the contents of register a to a/d control register q3. operation: (q3) grouping: input/output operation description: transfers the contents of register a to pull- up control register pu1. operation: (pu1)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-125 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by alphabet) (continued) tr3ab (transfer data to register r3 from accumulator and register b) tsiab (transfer data to register si from accumulator and register b) 1000111011 23b 11 grouping: timer operation description: transfers the contents of register b to the high-order 4 bits (r3 7 r3 4 ) of reload regis- ter r3, and the contents of register a to the low-order 4 bits (r3 3 r3 0 ) of reload regis- ter r3. operation: (r3 7 r3 4 ) r3 0 ) grouping: serial i/o operation description: transfers the contents of register b to the high-order 4 bits (si 7 si 4 ) of serial i/o reg- ister si, and transfers the contents of register a to the low-order 4 bits (si 3 si 0 ) of serial i/o register si. operation: (si 7 si 4 ) si 0 ) grouping: timer operation description: transfers the contents of register b to the high-order 4 bits (r1 7 r1 4 ) of reload regis- ter r1, and the contents of register a to the low-order 4 bits (r1 3 r1 0 ) of reload regis- ter r1. operation: (r1 7 r1 4 ) r1 0 ) grouping: clock control operation description: transfers the contents of register a to regis- ter rg. operation: (rg 0 )
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-126 rev.1.00 aug 06, 2004 rej09b0175-0100z tw1a (transfer data to register w1 from accumulator) 1000001110 20e 11 grouping: timer operation description: transfers the contents of register a to timer control register w1. operation: (w1) grouping: timer operation description: transfers the contents of register a to timer control register w2. operation: (w2) grouping: interrupt operation description: transfers the contents of register a to inter- rupt control register v2. operation: (v2) grouping: interrupt operation description: transfers the contents of register a to inter- rupt control register v1. operation: (v1)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-127 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by alphabet) (continued) tw5a (transfer data to register w5 from accumulator) tw6a (transfer data to register w6 from accumulator) 1000010011 213 11 grouping: timer operation description: transfers the contents of register a to timer control register w6. operation: (w6) grouping: timer operation description: transfers the contents of register a to timer control register w5. operation: (w5) operation: (w4) grouping: timer operation description: transfers the contents of register a to timer control register w3. operation: (w3)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-128 rev.1.00 aug 06, 2004 rej09b0175-0100z tya (transfer data to register y from accumulator) 0000001100 00c 11 grouping: register to register transfer description: transfers the contents of register a to regis- ter y. operation: (y) (a) wrst (watchdog timer reset) 1010100000 2a0 11 (wdf1) = 1 grouping: other operation description: skips the next instruction when watchdog timer flag wdf1 is ?.?after skipping, clears (0) to the wdf1 flag. when the wdf1 flag is ?,?executes the next instruction. also, stops the watchdog timer function when ex- ecuting the wrst instruction immediately after the dwdt instruction. operation: (wdf1) = 1 ? after skipping, (wdf1) 0 xam j (exchange accumulator and memory data) 101101 jjjj 2dj 11 grouping: ram to register transfer description: after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is performed between regis- ter x and the value j in the immediate field, and stores the result in register x. operation: (a) (m(dp)) (x) (x)exor(j) j = 0 to 15 xamd j (exchange accumulator and memory data and decrement register y and skip) 101111 jjjj 2fj 11 (y) = 15 grouping: ram to register transfer description: after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is performed between regis- ter x and the value j in the immediate field, and stores the result in register x. subtracts 1 from the contents of register y. as a result of subtraction, when the con- tents of register y is 15, the next instruction is skipped. when the contents of register y is not 15, the next instruction is executed. operation: (a) (m(dp)) (x) (x)exor(j) j = 0 to 15 (y) (y) ?1 machine instructions (index by alphabet) (continued)
skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0 d 9 d 0 d 9 d 0 d 9 d 0 hardware machine instructions (index by alphabet) 4519 group 1-129 rev.1.00 aug 06, 2004 rej09b0175-0100z xami j (exchange accumulator and memory data and increment register y and skip) 101110 jjjj 2ej 11 (y) = 0 grouping: ram to register transfer description: after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is performed between regis- ter x and the value j in the immediate field, and stores the result in register x. adds 1 to the contents of register y. as a re- sult of addition, when the contents of register y is 0, the next instruction is skipped. when the contents of register y is not 0, the next instruction is executed. operation: (a) (m(dp)) (x) (x)exor(j) j = 0 to 15 (y) (y) + 1 instruction code 2 16 machine instructions (index by alphabet) (continued) skip condition number of cycles number of words instruction code flag cy 2 16 d 9 d 0
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-130 rev.1.00 aug 06, 2004 rej09b0175-0100z (a) e 4 ) e 0 ) e 4 ) (a) e 0 ) (dr 2 dr 0 ) a 0 ) (a 2 a 0 ) dr 0 ) (a 3 ) a 0 ) sp 0 ) (a 3 ) 1 (a) 1 (a)
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-131 rev.1.00 aug 06, 2004 rej09b0175-0100z continuous description (y) = 0 (y) = 15 (y) = 15 (y) = 0 transfers the contents of register b to register a. transfers the contents of register a to register b. transfers the contents of register y to register a. transfers the contents of register a to register y. transfers the contents of register b to the high-order 4 bits (e 7 e 4 ) of register e, and the contents of regis- ter a to the low-order 4 bits (e 3 e 0 ) of register e. transfers the high-order 4 bits (e 7 e 4 ) of register e to register b, and low-order 4 bits (e 3 e 0 ) of register e to register a. transfers the contents of the low-order 3 bits (a 2 a 0 ) of register a to register d. transfers the contents of register d to the low-order 3 bits (a 2 a 0 ) of register a. transfers the contents of register z to the low-order 2 bits (a 1 , a 0 ) of register a. transfers the contents of register x to register a. transfers the contents of stack pointer (sp) to the low-order 3 bits (a 2 a 0 ) of register a. loads the value x in the immediate field to register x, and the value y in the immediate field to register y. when the lxy instructions are continuously coded and executed, only the first lxy instruction is executed and other lxy instructions coded continuously are skipped. loads the value z in the immediate field to register z. adds 1 to the contents of register y. as a result of addition, when the contents of register y is 0, the next in- struction is skipped. when the contents of register y is not 0, the next instruction is executed. subtracts 1 from the contents of register y. as a result of subtraction, when the contents of register y is 15, the next instruction is skipped. when the contents of register y is not 15, the next instruction is executed. after transferring the contents of m(dp) to register a, an exclusive or operation is performed between reg- ister x and the value j in the immediate field, and stores the result in register x. after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is per- formed between register x and the value j in the immediate field, and stores the result in register x. after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is per- formed between register x and the value j in the immediate field, and stores the result in register x. subtracts 1 from the contents of register y. as a result of subtraction, when the contents of register y is 15, the next instruction is skipped. when the contents of register y is not 15, the next instruction is executed. after exchanging the contents of m(dp) with the contents of register a, an exclusive or operation is per- formed between register x and the value j in the immediate field, and stores the result in register x. adds 1 to the contents of register y. as a result of addition, when the contents of register y is 0, the next in- struction is skipped. when the contents of register y is not 0, the next instruction is executed. after transferring the contents of register a to m(dp), an exclusive or operation is performed between reg- ister x and the value j in the immediate field, and stores the result in register x.
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-132 rev.1.00 aug 06, 2004 rej09b0175-0100z machine instructions (index by types) (continued) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 07n 08p +p 00a 00b 06n 018 019 007 006 02f 01c 01d 05c +j 04c +j 02j 026 025 07n 000111nnnn 0010p 5 p 4 p 3 p 2 p 1 p 0 0000001010 0000001011 000110nnnn 0000011000 0000011001 0000000111 0000000110 0000101111 0000011100 0000011101 00010111j j 00010011j j 00001000j j 0000100110 0000100101 000111nnnn la n tabp p am amc a n and or sc rc szc cma rar sb j rb j szb j seam sea n 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 arithmetic operation comparison operation bit operation (a) dr 0 , a 3 a 0 ) (dr 2 ) 4 (a) 0 (sk(sp)) 1 (a)
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-133 rev.1.00 aug 06, 2004 rej09b0175-0100z continuous description overflow = 0 (cy) = 0 (mj(dp)) = 0 j = 0 to 3 (a) = (m(dp)) (a) = n 0/1 1 0 0/1 loads the value n in the immediate field to register a. when the la instructions are continuously coded and executed, only the first la instruction is executed and other la instructions coded continuously are skipped. transfers bits 9 and 8 to register d, bits 7 to 4 to register b and bits 3 to 0 to register a. these bits 7 to 0 are the rom pattern in ad-dress (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 specified by registers a and d in page p. when this instruction is executed, be careful not to over the stack because 1 stage of stack register is used. adds the contents of m(dp) to register a. stores the result in register a. the contents of carry flag cy re- mains unchanged. adds the contents of m(dp) and carry flag cy to register a. stores the result in register a and carry flag cy. adds the value n in the immediate field to register a, and stores a result in register a. the contents of carry flag cy remains unchanged. skips the next instruction when there is no overflow as the result of operation. executes the next instruction when there is overflow as the result of operation. takes the and operation between the contents of register a and the contents of m(dp), and stores the re- sult in register a. takes the or operation between the contents of register a and the contents of m(dp), and stores the result in register a. sets (1) to carry flag cy. clears (0) to carry flag cy. skips the next instruction when the contents of carry flag cy is 0. stores the one s complement for register a s contents in register a. rotates 1 bit of the contents of register a including the contents of carry flag cy to the right. sets (1) the contents of bit j (bit specified by the value j in the immediate field) of m(dp). clears (0) the contents of bit j (bit specified by the value j in the immediate field) of m(dp). skips the next instruction when the contents of bit j (bit specified by the value j in the immediate field) of m(dp) is 0. executes the next instruction when the contents of bit j of m(dp) is 1. skips the next instruction when the contents of register a is equal to the contents of m(dp). executes the next instruction when the contents of register a is not equal to the contents of m(dp). skips the next instruction when the contents of register a is equal to the value n in the immediate field. executes the next instruction when the contents of register a is not equal to the value n in the immediate field.
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-134 rev.1.00 aug 06, 2004 rej09b0175-0100z b a bl p, a bla p bm a bml p, a bmla p rti rt rts 011a 6 a 5 a 4 a 3 a 2 a 1 a 0 00111p 4 p 3 p 2 p 1 p 0 10p 5 a 6 a 5 a 4 a 3 a 2 a 1 a 0 0000010000 10p 5 p 4 00p 3 p 2 p 1 p 0 010a 6 a 5 a 4 a 3 a 2 a 1 a 0 00110p 4 p 3 p 2 p 1 p 0 10p 5 a 6 a 5 a 4 a 3 a 2 a 1 a 0 0000110000 10p 5 p 4 00p 3 p 2 p 1 p 0 0001000110 0001000100 0001000101 18a +a 0ep +p 2pa +a 010 2pp 1aa 0cp +p 2pa +a 030 2pp 046 044 045 1 2 2 1 2 2 1 1 1 1 2 2 1 2 2 1 2 2 subroutine operation return operation machine instructions (index by types) (continued) (pc l ) a 6 ? 0 (pc h ) p (note) (pc l ) a 6 ? 0 (pc h ) p (note) (pc l ) (dr 2 ?r 0 , a 3 ? 0 ) (sp) (sp) + 1 (sk(sp)) (pc) (pc h ) 2 (pc l ) a 6 ? 0 (sp) (sp) + 1 (sk(sp)) (pc) (pc h ) p (note) (pc l ) a 6 ? 0 (sp) (sp) + 1 (sk(sp)) (pc) (pc h ) p (note) (pc l ) (dr 2 ?r 0 ,a 3 ? 0 ) (pc) (sk(sp)) (sp) (sp) ?1 (pc) (sk(sp)) (sp) (sp) ?1 (pc) (sk(sp)) (sp) (sp) ?1 branch operation note: p is 0 to 47 for m34519m6, p is 0 to 63 for m34519m8/e8.
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-135 rev.1.00 aug 06, 2004 rej09b0175-0100z skip at uncondition branch within a page : branches to address a in the identical page. branch out of a page : branches to address a in page p. branch out of a page : branches to address (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 specified by registers d and a in page p. call the subroutine in page 2 : calls the subroutine at address a in page 2. call the subroutine : calls the subroutine at address a in page p. call the subroutine : calls the subroutine at address (dr 2 dr 1 dr 0 a 3 a 2 a 1 a 0 ) 2 specified by registers d and a in page p. returns from interrupt service routine to main routine. returns each value of data pointer (x, y, z), carry flag, skip status, nop mode status by the continuous de- scription of the la/lxy instruction, register a and register b to the states just before interrupt. returns from subroutine to the routine called the subroutine. returns from subroutine to the routine called the subroutine, and skips the next instruction at uncondition.
machine instructions (index by types) 4519 group hardware 1-136 rev.1.00 aug 06, 2004 rej09b0175-0100z di ei snz0 snz1 snzi0 snzi1 tav1 tv1a tav2 tv2a tai1 ti1a tai2 ti2a tpaa taw1 tw1a taw2 tw2a taw3 tw3a taw4 tw4a (inte) 0 (inte) 1 v1 0 = 0: (exf0) = 1 ? after skipping, (exf0) 0 v1 0 = 1: snz0 = nop v1 1 = 0: (exf1) = 1 ? after skipping, (exf1) 0 v1 1 = 1: snz1 = nop i1 2 = 1 : (int0) = ??? i1 2 = 0 : (int0) = ?? ? i2 2 = 1 : (int1) = ??? i2 2 = 0 : (int1) = ?? ? (a) (v1) (v1) (a) (a) (v2) (v2) (a) (a) (i1) (i1) (a) (a) (i2) (i2) (a) (pa 0 ) (a 0 ) (a) (w1) (w1) (a) (a) (w2) (w2) (a) (a) (w3) (w3) (a) (a) (w4) (w4) (a) 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 004 005 038 039 03a 03b 054 03f 055 03e 253 217 254 218 2aa 24b 20e 24c 20f 24d 210 24e 211 0000000100 0000000101 0000111000 0000111001 0000111010 0000111011 0001010100 0000111111 0001010101 0000111110 1001010011 1000010111 1001010100 1000011000 1010101010 1001001011 1000001110 1001001100 1000001111 1001001101 1000010000 1001001110 1000010001 interrupt operation timer operation parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) (continued)
machine instructions (index by types) 4519 group hardware 1-137 rev.1.00 aug 06, 2004 rej09b0175-0100z v1 0 = 0: (exf0) = 1 v1 1 = 0: (exf1) = 1 (int0) = ? however, i1 2 = 1 (int0) = ? however, i1 2 = 0 (int1) = ? however, i2 2 = 1 (int1) = ? however, i2 2 = 0 skip condition datailed description carry flag cy clears (0) to interrupt enable flag inte, and disables the interrupt. sets (1) to interrupt enable flag inte, and enables the interrupt. when v1 0 = 0 : skips the next instruction when external 0 interrupt request flag exf0 is ?.?after skipping, clears (0) to the exf0 flag. when the exf0 flag is ?,?executes the next instruction. when v1 0 = 1 : this instruction is equivalent to the nop instruction. (v1 0 : bit 0 of interrupt control register v1) when v1 1 = 0 : skips the next instruction when external 1 interrupt request flag exf1 is ?.?after skipping, clears (0) to the exf1 flag. when the exf1 flag is ?,?executes the next instruction. when v1 1 = 1 : this instruction is equivalent to the nop instruction. (v1 1 : bit 1 of interrupt control register v1) when i1 2 = 1 : skips the next instruction when the level of int0 pin is ?.?(i1 2 : bit 2 of interrupt control reg- ister i1) when i1 2 = 0 : skips the next instruction when the level of int0 pin is ?. when i2 2 = 1 : skips the next instruction when the level of int1 pin is ?.?(i2 2 : bit 2 of interrupt control reg- ister i2) when i2 2 = 0 : skips the next instruction when the level of int1 pin is ?. transfers the contents of interrupt control register v1 to register a. transfers the contents of register a to interrupt control register v1. transfers the contents of interrupt control register v2 to register a. transfers the contents of register a to interrupt control register v2. transfers the contents of interrupt control register i1 to register a. transfers the contents of register a to interrupt control register i1. transfers the contents of interrupt control register i2 to register a. transfers the contents of register a to interrupt control register i2. transfers the contents of register a to timer control register pa. transfers the contents of timer control register w1 to register a. transfers the contents of register a to timer control register w1. transfers the contents of timer control register w2 to register a. transfers the contents of register a to timer control register w2. transfers the contents of timer control register w3 to register a. transfers the contents of register a to timer control register w3. transfers the contents of timer control register w4 to register a. transfers the contents of register a to timer control register w4.
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-138 rev.1.00 aug 06, 2004 rej09b0175-0100z 1001001111 1000010010 1001010000 1000010011 1001110101 1000110101 1001110000 1000110000 1001110001 1000110001 1001110010 1000110010 1001110011 1000110011 1000110111 1000111111 1000111011 1010010111 24f 212 250 213 275 235 270 230 271 231 272 232 273 233 237 23f 23b 297 (a) (w5) (w5) (a) (a) (w6) (w6) (a) (b) (tps 7 ?ps 4 ) (a) (tps 3 ?ps 0 ) (rps 7 ?ps 4 ) (b) (tps 7 ?ps 4 ) (b) (rps 3 ?ps 0 ) (a) (tps 3 ?ps 0 ) (a) (b) (t1 7 ?1 4 ) (a) (t1 3 ?1 0 ) (r1 7 ?1 4 ) (b) (t1 7 ?1 4 ) (b) (r1 3 ?1 0 ) (a) (t1 3 ?1 0 ) (a) (b) (t2 7 ?2 4 ) (a) (t2 3 ?2 0 ) (r2 7 ?2 4 ) (b) (t2 7 ?2 4 ) (b) (r2 3 ?2 0 ) (a) (t2 3 ?2 0 ) (a) (b) (t3 7 ?3 4 ) (a) (t3 3 ?3 0 ) (r3 7 ?3 4 ) (b) (t3 7 ?3 4 ) (b) (r3 3 ?3 0 ) (a) (t3 3 ?3 0 ) (a) (b) (t4 7 ?4 4 ) (a) (t4 3 ?4 0 ) (r4l 7 ?4l 4 ) (b) (t4 7 ?4 4 ) (b) (r4l 3 ?4l 0 ) (a) (t4 3 ?4 0 ) (a) (r4h 7 ?4h 4 ) (b) (r4h 3 ?4h 0 ) (a) (r1 7 ?1 4 ) (b) (r1 3 ?1 0 ) (a) (r3 7 ?3 4 ) (b) (r3 3 ?3 0 ) (a) (t4 7 ?4 0 ) (r4l 7 ?4l 0 ) taw5 tw5a taw6 tw6a tabps tpsab tab1 t1ab tab2 t2ab tab3 t3ab tab4 t4ab t4hab tr1ab tr3ab t4r4l 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 timer operation machine instructions (index by types) (continued)
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-139 rev.1.00 aug 06, 2004 rej09b0175-0100z transfers the contents of timer control register w5 to register a. transfers the contents of register a to timer control register w5. transfers the contents of timer control register w6 to register a. transfers the contents of register a to timer control register w6. transfers the high-order 4 bits of prescaler to register b, and transfers the low-order 4 bits of prescaler to register a. transfers the contents of register b to the high-order 4 bits of prescaler and prescaler reload register rps, and transfers the contents of register a to the low-order 4 bits of prescaler and prescaler reload register rps. transfers the high-order 4 bits of timer 1 to register b, and transfers the low-order 4 bits of timer 1 to regis- ter a. transfers the contents of register b to the high-order 4 bits of timer 1 and timer 1 reload register r1, and transfers the contents of register a to the low-order 4 bits of timer 1 and timer 1 reload register r1. transfers the high-order 4 bits of timer 2 to register b, and transfers the low-order 4 bits of timer 2 to regis- ter a. transfers the contents of register b to the high-order 4 bits of timer 2 and timer 2 reload register r2, and transfers the contents of register a to the low-order 4 bits of timer 2 and timer 2 reload register r2. transfers the high-order 4 bits of timer 3 to register b, and transfers the low-order 4 bits of timer 3 to regis- ter a. transfers the contents of register b to the high-order 4 bits of timer 3 and timer 3 reload register r3, and transfers the contents of register a to the low-order 4 bits of timer 3 and timer 3 reload register r3. transfers the high-order 4 bits of timer 4 to register b, and transfers the low-order 4 bits of timer 4 to regis- ter a. transfers the contents of register b to the high-order 4 bits of timer 4 and timer 4 reload register r4l, and transfers the contents of register a to the low-order 4 bits of timer 4 and timer 4 reload register r4l. transfers the contents of register b to the high-order 4 bits of timer 4 reload register r4h, and transfers the contents of register a to the low-order 4 bits of timer 4 reload register r4h. transfers the contents of register b to the high-order 4 bits of timer 1 reload register r1, and transfers the contents of register a to the low-order 4 bits of timer 1 reload register r1. transfers the contents of register b to the high-order 4 bits of timer 3 reload register r3, and transfers the contents of register a to the low-order 4 bits of timer 3 reload register r3. transfers the contents of timer 4 reload register r4l to timer 4.
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-140 rev.1.00 aug 06, 2004 rej09b0175-0100z 1010000000 1010000001 1010000010 1010000011 1001100000 1000100000 1001100001 1000100001 1001100010 1000100010 1001100011 1000100011 1001100100 1000100100 1001100101 1000100101 1001100110 1000100110 0000010001 0000010100 0000010101 0000100100 0000101011 1001010111 1000101101 1001011110 1000101110 280 281 282 283 260 220 261 221 262 222 263 223 264 224 265 225 266 226 011 014 015 024 02b 257 22d 25e 22e 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 snzt1 snzt2 snzt3 snzt4 iap0 op0a iap1 op1a iap2 op2a iap3 op3a iap4 op4a iap5 op5a iap6 op6a cld rd sd szd tapu0 tpu0a tapu1 tpu1a v1 2 = 0: (t1f) = 1 ? after skipping, (t1f) 0 v1 2 = 0: nop v1 3 = 0: (t2f) = 1 ? after skipping, (t2f) 0 v1 3 = 0: nop v2 0 = 0: (t3f) = 1 ? after skipping, (t3f) 0 v2 0 = 0: nop v2 1 = 0: (t4f) = 1 ? after skipping, (t4f) 0 v2 1 = 0: nop (a) (p0) (p0) (a) (a) (p1) (p1) (a) (a 2 ? 0 ) (p2 2 ?2 0 ) (a 3 ) 0 (p2 2 ?2 0 ) (a 2 ? 0 ) (a 1 , a 0 ) (p3 1 , p3 0 ) (p3 1 , p3 0 ) (a 1 , a 0 ) (a) (p4) (p4) (a) (a) (p5) (p5) (a) (a) (p6) (p6) (a) (d) 1 (d(y)) 0 (y) = 0 to 7 (d(y)) 1 (y) = 0 to 7 (d(y)) = 0 ? (y) = 0 to 7 (a) (pu0) (pu0) (a) (a) (pu1) (pu1) (a) input/output operation timer operation machine instructions (index by types) (continued)
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-141 rev.1.00 aug 06, 2004 rej09b0175-0100z skips the next instruction when the contents of bit 2 (v1 2 ) of interrupt control register v1 is 0 and the con- tents of t1f flag is 1. after skipping, clears (0) to t1f flag. skips the next instruction when the contents of bit 3 (v1 3 ) of interrupt control register v1 is 0 and the con- tents of t2f flag is 1. after skipping, clears (0) to t2f flag. skips the next instruction when the contents of bit 0 (v2 0 ) of interrupt control register v2 is 0 and the con- tents of t3f flag is 1. after skipping, clears (0) to t3f flag. skips the next instruction when the contents of bit 1 (v2 1 ) of interrupt control register v2 is 0 and the con- tents of t4f flag is 1. after skipping, clears (0) to t4f flag. transfers the input of port p0 to register a. outputs the contents of register a to port p0. transfers the input of port p1 to register a. outputs the contents of register a to port p1. transfers the input of port p2 to register a. outputs the contents of register a to port p2. transfers the input of port p3 to register a. outputs the contents of register a to port p3. transfers the input of port p4 to register a. outputs the contents of register a to port p4. transfers the input of port p5 to register a. outputs the contents of register a to port p5. transfers the input of port p6 to register a. outputs the contents of register a to port p6. sets (1) to all port d. clears (0) to a bit of port d specified by register y. sets (1) to a bit of port d specified by register y. skips the next instruction when a bit of port d specified by register y is 0. executes the next instruction when a bit of port d specified by register y is 1. transfers the contents of pull-up control register pu0 to register a. transfers the contents of register a to pull-up control register pu0. transfers the contents of pull-up control register pu1 to register a. transfers the contents of register a to pull-up control register pu1. v1 2 = 0: (t1f) = 1 v1 3 = 0: (t2f) =1 v2 0 = 0: (t3f) = 1 v2 1 = 0: (t4f) =1 (d(y)) = 0 however, (y)=0 to 7
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-142 rev.1.00 aug 06, 2004 rej09b0175-0100z tak0 tk0a tak1 tk1a tak2 tk2a tfr0a tfr1a tfr2a tfr3a tabsi tsiab sst snzsi taj1 tj1a cmck crck cyck trga tamr tmra 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 256 21b 259 214 25a 215 228 229 22a 22b 278 238 29e 288 242 202 29a 29b 29d 209 252 216 1001010110 1000011011 1001011001 1000010100 1001011010 1000010101 1000101000 1000101001 1000101010 1000101011 1001111000 1000111000 1010011110 1010001000 1001000010 1000000010 1010011010 1010011011 1010011101 1000001001 1001010010 1000010110 input/output operation (a) si 4 ) (a) si 0 ) (si 7 si 4 ) si 0 )
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-143 rev.1.00 aug 06, 2004 rej09b0175-0100z v2 3 = 0: (siof) = 1 transfers the contents of key-on wakeup control register k0 to register a. transfers the contents of register a to key-on wakeup control register k0 . transfers the contents of key-on wakeup control register k1 to register a. transfers the contents of register a to key-on wakeup control register k1. transfers the contents of key-on wakeup control register k2 to register a. transfers the contents of register a to key-on wakeup control register k2. transferts the contents of register a to port output format control register fr0. transferts the contents of register a to port output format control register fr1. transferts the contents of register a to port output format control register fr2. transferts the contents of register a to port output format control register fr3. transfers the high-order 4 bits of serial i/o register si to register b, and transfers the low-order 4 bits of se- rial i/o register si to register a. transfers the contents of register b to the high-order 4 bits of serial i/o register si, and transfers the con- tents of register a to the low-order 4 bits of serial i/o register si. clears (0) to siof flag and starts serial i/o. skips the next instruction when the contents of bit 3 (v2 3 ) of interrupt control register v2 is 0 and contents of siof flag is 1. after skipping, clears (0) to siof flag. transfers the contents of serial i/o control register j1 to register a. transfers the contents of register a to serial i/o control register j1. selects the ceramic resonator for main clock f(x in ). selects the rc oscillation circuit for main clock f(x in ). selects the quartz-crystal oscillation circuit for main clock f(x in ). transfers the contents of clock control regiser rg to register a. transfers the contents of clock control regiser mr to register a. transfers the contents of register a to clock control register mr.
parameter instruction code function number of cycles number of words mnemonic type of instructions d 9 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 hexadecimal notation machine instructions (index by types) 4519 group hardware 1-144 rev.1.00 aug 06, 2004 rej09b0175-0100z 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 279 249 239 29f 287 244 204 245 205 246 206 000 002 05b 003 2a0 29c 001 1001111001 1001001001 1000111001 1010011111 1010000111 1001000100 1000000100 1001000101 1000000101 1001000110 1000000110 0000000000 0000000010 0001011011 0000000011 1010100000 1010011100 0000000001 a/d conversion operation other operation machine instructions (index by types) (continued) tabad tala tadab adst snzad taq1 tq1a taq2 tq2a taq3 tq3a nop pof epof snzp wrst dwdt srst q1 3 = 0: (b) ad 6 ) (a) ad 2 ) q1 3 = 1: (b) ad 4 ) (a) ad 0 ) (a 3 , a 2 ) ad 4 ) ad 0 )
skip condition datailed description carry flag cy machine instructions (index by types) 4519 group hardware 1-145 rev.1.00 aug 06, 2004 rej09b0175-0100z v2 2 = 0: (adf) = 1 (p) = 1 (wdf1) = 1 in the a/d conversion mode (q1 3 = 0), transfers the high-order 4 bits (ad 9 ad 6 ) of register ad to register b, and the middle-order 4 bits (ad 5 ad 2 ) of register ad to register a. in the comparator mode (q1 3 = 1), transfers the middle-order 4 bits (ad 7 ad 4 ) of register ad to register b, and the low-order 4 bits (ad 3 ad 0 ) of register ad to register a. (q1 3 : bit 3 of a/d control register q1) transfers the low-order 2 bits (ad 1 , ad 0 ) of register ad to the high-order 2 bits (ad 3 , ad 2 ) of register a. in the comparator mode (q1 3 = 1), transfers the contents of register b to the high-order 4 bits (ad 7 ad 4 ) of comparator register, and the contents of register a to the low-order 4 bits (ad 3 ad 0 ) of comparator register. (q1 3 = bit 3 of a/d control register q1) clears (0) to a/d conversion completion flag adf, and the a/d conversion at the a/d conversion mode (q1 3 = 0) or the comparator operation at the comparator mode (q1 3 = 1) is started. (q1 3 = bit 3 of a/d control register q1) when v2 2 = 0 : skips the next instruction when a/d conversion completion flag adf is 1. after skipping, clears (0) to the adf flag. when the adf flag is 0, executes the next instruction. (v2 2 : bit 2 of interrupt con- trol register v2) transfers the contents of a/d control register q1 to register a. transfers the contents of register a to a/d control register q1. transfers the contents of a/d control register q2 to register a. transfers the contents of register a to a/d control register q2. transfers the contents of a/d control register q3 to register a. transfers the contents of register a to a/d control register q3. no operation; adds 1 to program counter value, and others remain unchanged. puts the system in ram back-up state by executing the pof instruction after executing the epof instruction. makes the immediate after pof instruction valid by executing the epof instruction. skips the next instruction when the p flag is 1 . after skipping, the p flag remains unchanged. skips the next instruction when watchdog timer flag wdf1 is 1. after skipping, clears (0) to the wdf1 flag. also, stops the watchdog timer function when executing the wrst instruction immediately after the dwdt instruction. stops the watchdog timer function by the wrst instruction after executing the dwdt instruction. system reset occurs.
4519 group hardware 1-146 rev.1.00 aug 06, 2004 rej09b0175-0100z instruction code table d 3 d 0 hex. notation 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 a b c d e f d 9 d 4 00 nop srst pof snzp di ei rc sc am amc tya tba 000001 01 bla cld iny rd sd dey and or teab cma rar tab tay 000010 02 szb 0 szb 1 szb 2 szb 3 szd sean seam tda tabe szc 000011 03 bmla snz0 snz1 snzi0 snzi1 tv2a tv1a 000100 04 rt rts rti lz 0 lz 1 lz 2 lz 3 rb 0 rb 1 rb 2 rb 3 000101 05 tasp tad tax taz tav1 tav2 epof sb 0 sb 1 sb 2 sb 3 000110 06 a 0 a 1 a 2 a 3 a 4 a 5 a 6 a 7 a 8 a 9 a 10 a 11 a 12 a 13 a 14 a 15 000111 07 la 0 la 1 la 2 la 3 la 4 la 5 la 6 la 7 la 8 la 9 la 10 la 11 la 12 la 13 la 14 la 15 001000 08 tabp 0 tabp 1 tabp 2 tabp 3 tabp 4 tabp 5 tabp 6 tabp 7 tabp 8 tabp 9 tabp 10 tabp 11 tabp 12 tabp 13 tabp 14 tabp 15 001001 09 tabp 16 tabp 17 tabp 18 tabp 19 tabp 20 tabp 21 tabp 22 tabp 23 tabp 24 tabp 25 tabp 26 tabp 27 tabp 28 tabp 29 tabp 30 tabp 31 001010 tabp 32 tabp 33 tabp 34 tabp 35 tabp 36 tabp 37 tabp 38 tabp 39 tabp 40 tabp 41 tabp 42 tabp 43 tabp 44 tabp 45 tabp 46 tabp 47 001011 001100 0c 001101 0d 001110 0e 001111 0f bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bml bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bl bm bm bm bm bm bm bm bm bm bm bm bm bm bm bm bm 010000 010111 011000 011111 18 1f b b b b b b b b b b b b b b b b bl bml bla bmla sea szd the second word 1p paaa aaaa 1p paaa aaaa 1p pp00 pppp 1p pp00 pppp 00 0111 nnnn 00 0010 1011 * cannot be used in the m34519m6. 10 17 000000 the above table shows the relationship between machine language codes and machine language instructions. d 3 d 0 show the low-order 4 bits of the machine language code, and d 9 d 4 show the high-order 6 bits of the machine language code. the hexadecimal representa- tion of the code is also provided. there are one-word instructions and two-word instructions, but only the first word of each i nstruction is shown. do not use code marked . the codes for the second word of a two-word instruction are described below. 0a tabp 48* tabp 49* tabp 50* tabp 51* tabp 52* tabp 53* tabp 54* tabp 55* tabp 56* tabp 57* tabp 58* tabp 59* tabp 60* tabp 61* tabp 62* tabp 63* 0b instruction code table
4519 group hardware 1-147 rev.1.00 aug 06, 2004 rej09b0175-0100z instruction code table (continued) tj1a tq1a tq2a tq3a trga tw1a tw2a tw3a tw4a tw5a tw6a tk1a tk2a tmra ti1a ti2a tk0a t1ab t2ab t3ab t4ab tpsab t4hab tsiab tadab tr3ab tr1ab taj1 taq1 taq2 taq3 tala taw1 taw2 taw3 taw4 taw5 taw6 tamr tai1 tai2 tak0 tapu0 tak1 tak2 tapu1 iap0 iap1 iap2 iap3 iap4 iap5 iap6 tab1 tab2 tab3 tab4 tabps tabsi tabad snzt1 snzt2 snzt3 snzt4 snzad snzsi t4r4l cmck crck dwdt cyck sst adst wrst tpaa tam 0 tam 1 tam 2 tam 3 tam 4 tam 5 tam 6 tam 7 tam 8 tam 9 tam 10 tam 11 tam 12 tam 13 tam 14 tam 15 xam 0 xam 1 xam 2 xam 3 xam 4 xam 5 xam 6 xam 7 xam 8 xam 9 xam 10 xam 11 xam 12 xam 13 xam 14 xam 15 xami 0 xami 1 xami 2 xami 3 xami 4 xami 5 xami 6 xami 7 xami 8 xami 9 xami 10 xami 11 xami 12 xami 13 xami 14 xami 15 xamd 0 xamd 1 xamd 2 xamd 3 xamd 4 xamd 5 xamd 6 xamd 7 xamd 8 xamd 9 xamd 10 xamd 11 xamd 12 xamd 13 xamd 14 xamd 15 lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy lxy tma 0 tma 1 tma 2 tma 3 tma 4 tma 5 tma 6 tma 7 tma 8 tma 9 tma 10 tma 11 tma 12 tma 13 tma 14 tma 15 bl bml bla bmla sea szd the second word 1p paaa aaaa 1p paaa aaaa 1p pp00 pppp 1p pp00 pppp 00 0111 nnnn 00 0010 1011 op0a op1a op2a op3a op4a op5a op6a tfr0a tfr1a tfr2a tfr3a tpu0a tpu1a d 3 d 0 hex. notation 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0 1 2 3 4 5 6 7 8 9 a b c d e f d 9 d 4 20 100001 21 100010 22 100011 23 100100 24 100101 25 100110 26 100111 27 101000 28 101001 29 101010 2a 101011 2b 101100 2c 101101 2d 101110 2e 101111 2f 110000 111111 30 3f 100000 the above table shows the relationship between machine language codes and machine language instructions. d 3 d 0 show the low- order 4 bits of the machine language code, and d 9 d 4 show the high-order 6 bits of the machine language code. the hexadecimal representation of the code is also provided. there are one-word instructions and two-word instructions, but only the first word of each instruction is shown. do not use code marked . the codes for the second word of a two-word instruction are described below. instruction code table
4519 group hardware 1-148 rev.1.00 aug 06, 2004 rej09b0175-0100z table 24 product of built-in prom version prom size ( ? ?
4519 group hardware 1-149 rev.1.00 aug 06, 2004 rej09b0175-0100z (1) prom mode the built-in prom version has a prom mode in addition to a nor- mal operation mode. the prom mode is used to write to and read from the built-in prom. in the prom mode, the programming adapter can be used with a general-purpose prom programmer to write to or read from the built-in prom as if it were m5m27c256k. programming adapter is listed in table 24. contact addresses at the end of this data sheet for the appropriate prom programmer. writing and reading of built-in prom programming voltage is 12.5 v. write the program in the prom of the built-in prom version as shown in figure 73. (2) notes on handling ? ?
chapter 2 application 2.1 i/o pins 2.2 interrupts 2.3 timers 2.4 a/d converter 2.5 serial i/o 2.6 reset 2.7 voltage drop detection circuit 2.8 ram back-up 2.9 oscillation circuit
4519 group application 2.1 i/o pins 2-2 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.1 i/o pins the 4519 group has thirty-five i/o pins. port p2 is also used as serial i/o pins s ck , s out , s in . port p3 0 is also used as int0 input pin. port p3 1 is also used as int1 input pin. port p4 is also used as analog input pins a in4 ? in7 . port p6 is also used as analog input pins a in0 ? in3 . port d 6 is also used as cntr0 i/o pin. port d 7 is also used as cntr1 i/o pin. this section describes each port i/o function, related registers, application example using each port function and notes. 2.1.1 i/o ports (1) port p0 port p0 is a 4-bit i/o port. port p0 has the key-on wakeup function which turns on/off with register k0 and pull-up transistor which turns on/off with register pu0. input in the following conditions, the pin state of port p0 is transferred as input data to register a when the iap0 instruction is executed. ?set bit fr0 0 or bit fr0 1 of register fr0 to ??according to the port to be used. ?set the output latch of specified port p0i (i=0, 1, 2 or 3) to ??with the op0a instruction. if fr0 0 or fr0 1 is ??and the output latch is ?? ??is output to specified port p0. if fr0 0 or fr0 1 is ?? the output latch value is output to specified port p0. output the contents of register a is set to the output latch with the op0a instruction, and is output to port p0. n-channel open-drain or cmos can be selected as the output structure of port p0 in 2 bits unit by setting fr0 0 or fr0 1 . (2) port p1 port p1 is a 4-bit i/o port. port p1 has the key-on wakeup function which turns on/off with register k0 and pull-up transistor which turns on/off with register pu1. input in the following conditions, the pin state of port p1 is transferred as input data to register a when the iap1 instruction is executed. ?set bit fr0 2 or bit fr0 3 of register fr0 to ??according to the port to be used. ?set the output latch of specified port p1i (i=0, 1, 2 or 3) to ??with the op1a instruction. if fr0 2 or fr0 3 is ??and the output latch is ?? ??is output to specified port p1. if fr0 2 or fr0 3 is ?? the output latch value is output to specified port p1. output the contents of register a is set to the output latch with the op1a instruction, and is output to port p1. n-channel open-drain or cmos can be selected as the output structure of port p1 in 2 bits unit by setting fr0 2 or fr0 3 .
4519 group application 2.1 i/o pins 2-3 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) port p2 port p2 is a 3-bit i/o port. p2 0 ?2 3 are also used as serial i/o pins s ck , s out , s in . input in the following condition, the pin state of port p2 is transferred as input data to register a when the iap2 instruction is executed. ?set the output latch of specified port p2i (i=0, 1 or 2) to ??with the op2a instruction. if the output latch is ?? ??is output to specified port p2. output the contents of register a is set to the output latch with the op2a instruction, and is output to port p2. the output structure is an n-channel open-drain. notes 1: port p2 0 is also used as the serial i/o pin s ck . accordingly, when port p2 0 is used as an input/output port, set bits j1 1 and j1 0 of register j1 to ?0 2 ? also, set bits j1 3 and j1 2 of register j1 to ?0 2 ? ?1 2 ?or ?0 2 ? 2: port p2 1 is also used as the serial i/o pin s out . accordingly, when port p2 1 is used as an input/output port, set bits j1 1 and j1 0 of register j1 to ?0 2 ?or ?0 2 ? 3: port p2 2 is also used as the serial i/o pin s in . accordingly, when port p2 2 is used as an input/output port, set bits j1 1 and j1 0 of register j1 to ?0 2 ?or ?0 2 ? (4) port p3 port p3 is a 4-bit i/o port. p3 0 is also used as int0 input pin and p3 1 is also used as int1 input pin. also, the key-on wakeup function of int0 and int1 can be turned on/off by setting bits k2 0 and k2 2 of register k2. input in the following condition, the pin state of port p3 is transferred as input data to register a when the iap3 instruction is executed. ?set the output latch of specified port p3i (i=0, 1, 2 or 3) to ??with the op3a instruction. if the output latch is ?? ??is output to specified port p3. output the contents of register a is set to the output latch with the op3a instruction, and is output to port p3. the output structure is an n-channel open-drain. (5) port p4 port p4 is a 4-bit i/o port.
4519 group application 2.1 i/o pins 2-4 rev.1.00 aug 06, 2004 rej09b0175-0100z port p4 0 ?4 3 are also used as analog input pins a in4 ? in7 . input in the following conditions, the pin state of port p4 is transferred as input data to register a when the iap4 instruction is executed. ?set the output latch of specified port p4i (i=0, 1, 2 or 3) to ??with the op4a instruction. if the output latch is ?? ??is output to specified port p4. output the contents of register a is set to the output latch with the op4a instruction, and is output to port p4. the output structure is an n-channel open-drain. (6) port p5 port p5 is a 4-bit i/o port. input in the following conditions, the pin state of port p5 is transferred as input data to register a when the iap5 instruction is executed. ?set bit fr3 i (i=0, 1, 2 or 3) of register fr3 to ??according to the port to be used. ?set the output latch of specified port p5i (i=0, 1, 2 or 3) to ??with the op5a instruction. if fr3 i is ??and the output latch is ?? ??is output to specified port p5. if fr3 i is ?? the output latch value is output to specified port p5. output the contents of register a is set to the output latch with the op5a instruction, and is output to port p5. n-channel open-drain or cmos can be selected as the output structure of port p5 in 2 bits unit by setting fr3 i . (7) port p6 port p6 is a 4-bit i/o port. port p6 0 ?6 3 are also used as analog input pins a in0 ? in3 . input in the following conditions, the pin state of port p6 is transferred as input data to register a when the iap6 instruction is executed. ?set the output latch of specified port p6i (i=0, 1, 2 or 3) to ??with the op6a instruction. if the output latch is ?? ??is output to specified port p6. output the contents of register a is set to the output latch with the op6a instruction, and is output to port p6. the output structure is an n-channel open-drain.
4519 group application 2.1 i/o pins 2-5 rev.1.00 aug 06, 2004 rej09b0175-0100z (8) port d ports d 0 ? 7 are eight independent i/o ports. port d 6 is also used as cntr0 i/o pin. port d 7 is also used as cntr1 i/o pin. input/output of port d each pin of port d has an independent 1-bit wide i/o function. for i/o of ports d 0 ? 7 , select one of port d with the register y of the data pointer first. input the pin state of port d can be obtained with the szd instruction. in the following conditions, if the pin state of port dj (j=0, 1, 2, 3, 4, 5, 6 or 7) is ??when the szd instruction is executed, the next instruction is skipped. if it is ??when the szd instruction is executed, the next instruction is executed. ?set bit i (i=0,1,2 or 3) of register fr1 or fr2 to ??according to the port to be used. ?set the output latch of specified port dj to ??with the sd instruction. if fr1 i or fr2 i is ??and the output latch is ?? ??is output to specified port d. if fr1 i or fr2 i is ?? the output latch value is output to specified port d. output set the output level to the output latch with the sd , cld and rd instructions. the state of pin enters the high-impedance state when the sd instruction is executed. all port d enter the high-impedance state or ??level state when the cld instruction is executed. the state of pin becomes ??level when the rd instruction is executed. n-channel open-drain or cmos can be selected as the output structure of ports d 0 ? 7 in 1 bit unit by setting registers fr1, fr2. notes 1: when the sd and rd instructions are used, do not set ?000 2 ?or more to register y. 2: port d 6 is also used as cntr0 pin. accordingly, when using port d 6 , set bit 0 (w6 0 ) of register w6 to ?. 3: port d 7 is also used as cntr1 pin. accordingly, when using port d 7 , set bit 3 (w4 3 ) of register w4 to ?.
4519 group application 2.1 i/o pins 2-6 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.1.2 related registers (1) timer control register w4 table 2.1.1 shows the timer control register w4. set the contents of this register through register a with the tw4a instruction. the contents of register w4 is transferred to register a with the taw4 instruction. table 2.1.1 timer control register w4 timer control register w4 at reset : 0000 2 d 7 (i/o) / cntr1 (input) cntr1 (i/o) / d 7 (input) pwm signal ??interval expansion function invalid pwm signal ??interval expansion function valid stop (state retained) operating x in input prescaler output (orclk) divided by 2 d 7 /cntr1 pin function selection bit pwm signal ??interval expansion function control bit timer 4 control bit timer 4 count source selection bit 0 1 0 1 0 1 0 1 w4 3 w4 2 w4 1 w4 0 notes 1: ??represents read enabled, and ??represents write enabled. 2: when setting the port, w4 2 ?4 0 are not used. at ram back-up : state retained r/w (2) timer control register w6 table 2.1.2 shows the timer control register w6. set the contents of this register through register a with the tw6a instruction. the contents of register w6 is transferred to register a with the taw6 instruction. table 2.1.2 timer control register w6 notes 1: ??represents read enabled, and ??represents write enabled. 2: when setting the port, w6 3 ?6 1 are not used. timer control register w6 at reset : 0000 2 falling edge rising edge falling edge rising edge cntr1 output auto-control circuit not selected cntr1 output auto-control circuit selected d 6 (i/o)/cntr0 input cntr0 input/output/d 6 (input) cntr1 pin input count edge selection bit cntr0 pin input count edge selection bit cntr1 output auto-control circuit selection bit d 6 /cntr0 pin function selection bit ( note 2 ) 0 1 0 1 0 1 0 1 w6 3 w6 2 w6 1 w6 0 at ram back-up : state retained r/w
4519 group application 2.1 i/o pins 2-7 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) serial i/o control register j1 table 2.1.3 shows the serial i/o control register j1. set the contents of this register through register a with the tj1a instruction. the contents of register j1 is transferred to register a with the taj1 instruction. table 2.1.3 serial i/o control register j1 serial i/o control register j1 at reset : 0000 2 synchronous clock instruction clock (instck) divided by 8 instruction clock (instck) divided by 4 instruction clock (instck) divided by 2 external clock (s ck input) port function p2 0 , p2 1 , p2 2 selected/s ck , s out , s in not selected s ck , s out , p2 2 selected/p2 0 , p2 1 , s in not selected s ck , p2 1 , s in selected/p2 0 , s out , p2 2 not selected s ck , s out , s in selected/p2 0 , p2 1 , p2 2 not selected serial i/o synchronous clock selection bits serial i/o port function selection bits j1 3 j1 2 notes 1: ??represents read enabled, and ??represents write enabled. 2: when setting the port, j1 3 ?1 2 are not used. j1 3 0 0 1 1 j1 1 0 0 1 1 j1 2 0 1 0 1 j1 0 0 1 0 1 j1 1 j1 0 at ram back-up : state retained r/w (4) a/d control register q2 table 2.1.4 shows the a/d control register q2. set the contents of this register through register a with the tq2a instruction. the contents of register q2 is transferred to register a with the taq2 instruction. table 2.1.4 a/d control register q2 notes 1: ??represents read enabled, and ??represents write enabled. 2: in order to select a in3 ? in0 , set register q1 after setting register q2. a/d control register q2 at reset : 0000 2 p4 0 , p4 1 , p4 2 , p4 3 a in4 , a in5 , a in6 , a in7 p6 2 , p6 3 a in2 , a in3 p6 1 a in1 p6 0 a in0 p4 0 /a in4 , p4 1 /a in5 , p4 2 /a in6 , p4 3 / a in7 pin function selection bit p6 2 /a in2 , p6 3 /a in3 pin function selection bit p6 1 /a in1 pin function selection bit p6 0 /a in0 pin function selection bit 0 1 0 1 0 1 0 1 q2 3 q2 2 q2 1 q2 0 at ram back-up : state retained r/w
4519 group application 2.1 i/o pins 2-8 rev.1.00 aug 06, 2004 rej09b0175-0100z pull-up control register pu1 at reset : 0000 2 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p1 3 pin pull-up transistor control bit p1 2 pin pull-up transistor control bit p1 1 pin pull-up transistor control bit p1 0 pin pull-up transistor control bit 0 1 0 1 0 1 0 1 pu1 3 pu1 2 pu1 1 pu1 0 note: ??represents read enabled, and ??represents write enabled. note: ??represents read enabled, and ??represents write enabled. (6) pull-up control register pu1 table 2.1.6 shows the pull-up control register pu1. set the contents of this register through register a with the tpu1a instruction. the contents of register pu1 is transferred to register a with the tapu1 instruction. table 2.1.6 pull-up control register pu1 pull-up control register pu0 at reset : 0000 2 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p0 3 pin pull-up transistor control bit p0 2 pin pull-up transistor control bit p0 1 pin pull-up transistor control bit p0 0 pin pull-up transistor control bit 0 1 0 1 0 1 0 1 pu0 3 pu0 2 pu0 1 pu0 0 (5) pull-up control register pu0 table 2.1.5 shows the pull-up control register pu0. set the contents of this register through register a with the tpu0a instruction. the contents of register pu0 is transferred to register a with the tapu0 instruction. table 2.1.5 pull-up control register pu0 at ram back-up : state retained r/w at ram back-up : state retained r/w
4519 group application 2.1 i/o pins 2-9 rev.1.00 aug 06, 2004 rej09b0175-0100z port output structure control register fr1 at r eset : 0000 2 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port d 3 output structure selection bit port d 2 output structure selection bit port d 1 output structure selection bit port d 0 output structure selection bit 0 1 0 1 0 1 0 1 fr1 3 fr1 2 fr1 1 fr1 0 note: ??represents write enabled. note: ??represents write enabled. (8) port output structure control register fr1 table 2.1.8 shows the port output structure control register fr1. set the contents of this register through register a with the tfr1a instruction. table 2.1.8 port output structure control register fr1 port output structure control register fr0 at r eset : 0000 2 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output ports p1 2 , p1 3 output structure selection bit ports p1 0 , p1 1 output structure selection bit ports p0 2 , p0 3 output structure selection bit ports p0 1 , p0 0 output structure selection bit 0 1 0 1 0 1 0 1 fr0 3 fr0 2 fr0 1 fr0 0 (7) port output structure control register fr0 table 2.1.7 shows the port output structure control register fr0. set the contents of this register through register a with the tfr0a instruction. table 2.1.7 port output structure control register fr0 at ram back-up : state retained w at ram back-up : state retained w
4519 group application 2.1 i/o pins 2-10 rev.1.00 aug 06, 2004 rej09b0175-0100z port output structure control register fr3 at reset : 0000 2 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port p5 3 output structure selection bit port p5 2 output structure selection bit port p5 1 output structure selection bit port p5 0 output structure selection bit 0 1 0 1 0 1 0 1 fr3 3 fr3 2 fr3 1 fr3 0 note: ??represents write enabled. note: ??represents write enabled. (10) port output structure control register fr3 table 2.1.10 shows the port output structure control register fr3. set the contents of this register through register a with the tfr3a instruction. table 2.1.10 port output structure control register fr3 port output structure control register fr2 at r eset : 0000 2 n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output n-channel open-drain output cmos output port d 7 /cntr1 output structure selection bit port d 6 /cntr0 output structure selection bit port d 5 output structure selection bit port d 4 output structure selection bit 0 1 0 1 0 1 0 1 fr2 3 fr2 2 fr2 1 fr2 0 (9) port output structure control register fr2 table 2.1.9 shows the port output structure control register fr2. set the contents of this register through register a with the tfr2a instruction. table 2.1.9 port output structure control register fr2 at ram back-up : state retained w at ram back-up : state retained w
4519 group application 2.1 i/o pins 2-11 rev.1.00 aug 06, 2004 rej09b0175-0100z (11) key-on wakeup control register k0 table 2.1.11 shows the key-on wakeup control register k0. set the contents of this register through register a with the tk0a instruction. the contents of register k0 is transferred to register a with the tak0 instruction. table 2.1.11 key-on wakeup control register k0 key-on wakeup control register k0 at reset : 0000 2 key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used pins p1 2 , p1 3 key-on wakeup control bit pins p1 0 , p1 1 key-on wakeup control bit pins p0 2 , p0 3 key-on wakeup control bit pins p0 0 , p0 1 key-on wakeup control bit 0 1 0 1 0 1 0 1 k0 3 k0 2 k0 1 k0 0 note: ??represents read enabled, and ??represents write enabled. at ram back-up : state retained r/w (12) key-on wakeup control register k2 table 2.1.12 shows the key-on wakeup control register k2. set the contents of this register through register a with the tk2a instruction. the contents of register k2 is transferred to register a with the tak2 instruction. table 2.1.12 key-on wakeup control register k2 key-on wakeup control register k2 at reset : 0000 2 return by level return by edge key-on wakeup invalid key-on wakeup valid returned by level returned by edge key-on wakeup invalid key-on wakeup valid int1 pin return condition selection bit int1 pin key-on wakeup control bit int0 pin return condition selection bit int0 pin key-on wakeup control bit 0 1 0 1 0 1 0 1 k2 3 k2 2 k2 1 k2 0 note: ??represents read enabled, and ??represents write enabled. at ram back-up : state retained r/w
4519 group application 2.1 i/o pins 2-12 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.1.3 port application examples (1) key input by key scan key matrix can be set up by connecting keys externally because port d output structure is an n- channel open-drain and port p0 has the pull-up resistor. outline: the connecting required external part is just keys. specifications: port d is used to output ??level and port p0 is used to input 16 keys. figure 2.1.1 shows the key input and figure 2.1.2 shows the key input timing. fig. 2.1.1 key input by key scan fig. 2.1.2 key scan input timing d 0 d 1 d 2 d 3 i a p 0iap0i a p 0iap0 i a p 0 h l h l h l h l i n p u t t o s w 1 s w 4 input to sw13 sw16 input to sw9 sw12 i n p u t t o s w 5 s w 8 i n p u t t o s w 1 s w 4 key input period switching key input selection port (d d ) stabilizing wait time for input reading port (key input) n o t e : h o u t p u t o f p o r t d b e c o m e s h i g h - i m p e d a n c e s t a t e . 01 sw4 sw3 sw2 sw8 sw7 sw6 sw9 sw11 sw10 sw12 sw16 sw15 sw14 sw13 d 0 d 1 d 2 d 3 p0 0 p0 1 p0 2 p0 3 sw1 sw5 m34519
4519 group application 2.1 i/o pins 2-13 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.1.4 notes on use (1) note when an i/o port is used as an input port set the output latch to 1 and input the port value before input. if the output latch is set to 0, l level can be input. as for the port which has the output structure selection function, select the n-channel open-drain output structure. (2) noise and latch-up prevention connect an approximate 0.1 ? (3) multifunction be careful that the output of ports p3 0 and p3 1 can be used even when int0 and int1 pins are selected. be careful that the input of ports p2 0 ep2 2 can be used even when s in , s out and s ck pins are selected. be careful that the input/output of port d 6 can be used even when input of cntr0 pin is selected. be careful that the input of port d 6 can be used even when output of cntr0 pin is selected. be careful that the input/output of port d 7 can be used even when input of cntr1 pin is selected. be careful that the input of port d 7 can be used even when output of cntr1 pin is selected. (4) connection of unused pins table 2.1.13 shows the connections of unused pins. (5) sd, rd, szd instructions when the sd , rd , or szd instructions is used, do not set 1000 2 or more to register y. (6) port p3 0 /int0 pin when the ram back-up mode is used by clearing the bit 3 of register i1 to 0 and setting the input of int0 pin to be disabled, be careful about the following note. when the input of int0 pin is disabled (register i1 3 = 0), clear bit 0 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode. (7) port p3 1 /int1 pin when the ram back-up mode is used by clearing the bit 3 of register i2 to 0 and setting the input of int1 pin to be disabled, be careful about the following note. when the input of int1 pin is disabled (register i2 3 = 0), clear bit 2 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode.
4519 group application 2.1 i/o pins 2-14 rev.1.00 aug 06, 2004 rej09b0175-0100z connection open. open. open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. pin x in x out d 0 ? 5 d 6 /cntr0 d 7 /cntr1 p0 0 ?0 3 p1 0 ?1 3 p2 0 /s ck p2 1 /s out p2 2 /s in p3 0 /int0 p3 1 /int1 p3 2 , p3 3 p4 0 /a in4 ?4 3 / a in7 p5 0 ?5 3 p6 0 /a in0 ?6 3 / a in3 usage condition internal oscillator is selected. ( note 1 ) internal oscillator is selected. ( note 1 ) rc oscillator is selected. ( note 2 ) external clock input is selected for main clock. ( note 3 ) n-channel open-drain is selected for the output structure. ( note 4 ) cntr0 input is not selected for timer 1 count source. n-channel open-drain is selected for the output structure. ( note 4 ) cntr1 input is not selected for timer 3 count source. n-channel open-drain is selected for the output structure. ( note 4 ) the key-on wakeup function is not selected. ( note 6 ) n-channel open-drain is selected for the output structure. ( note 5 ) the pull-up function is not selected. ( note 4 ) the key-on wakeup function is not selected. ( note 6 ) the key-on wakeup function is not selected. ( note 7 ) n-channel open-drain is selected for the output structure. ( note 5 ) the pull-up function is not selected. ( note 4 ) the key-on wakeup function is not selected. ( note 7 ) s ck pin is not selected. s in pin is not selected. ??is set to output latch. ??is set to output latch. n-channel open-drain is selected for the output structure. table 2.1.13 connections of unused pins notes 1: after system is released from reset, the internal oscillation (on-chip oscillator) is selected for system clock (rg 0 =0, mr 0 =1). 2: when the crck instruction is executed, the rc oscillation circuit becomes valid. be careful that the swich of system clock is not executed at oscillation start only by the crck instruction execution. in order to start oscillation, setting the main clock f(x in ) oscillation to be valid (mr 1 =0) is required. (if necessary, gen- erate the oscillation stabilizing wait time by software.) also, when the main clock (f(x in )) is selected as system clock, set the main clock f(x in ) oscillation (mr 1 =0) to be valid, and select main clock f(x in ) (mr 0 =0). be careful that the switch of system clock cannot be executed at the same time when main clock oscillation is started. 3: in order to use the external clock input for the main clock, select the ceramic resonance by executing the cmck in- struction at the beggining of software, and then set the main clock (f(x in )) oscillation to be valid (mr 1 =0). until the main clock (f(x in )) oscillation becomes valid (mr 1 =0) after ceramic resonance becomes valid, x in pin is fixed to ?? when an external clock is used, insert a 1 k ? resistor to x in pin in series for limits of current . 4: be sure to select the output structure of ports d 0 ? 5 and the pull-up function of p0 0 ?0 3 and p1 0 ?1 3 with every one port. set the corresponding bits of registers for each port. 5: be sure to select the output structure of ports p0 0 ?0 3 and p1 0 ?1 3 with every two ports. if only one of the two pins is used, leave another one open. 6: the key-on wakeup function is selected with every two bits. when only one of key-on wakeup function is used, con- sidering that the value of key-on wake-up control register k1, set the unused 1-bit to ??input (turn pull-up transistor on and open) or ??input (connect to v ss , or open and set the output latch to ??. 7: the key-on wakeup function is selected with every two bits. when one of key-on wakeup function is used, turn pull-up transistor of unused one on and open. (note when connecting to v ss and v dd ) connect the unused pins to v ss and v dd using the thickest wire at the shortest distance against noise.
4519 group application 2.2 interrupts 2-15 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.2 interrupts the 4519 group has eight interrupt sources : external (int0, int1), timer 1, timer 2, timer 3, timer 4, a/ d and serial i/o. this section describes individual types of interrupts, related registers, application examples using interrupts and notes. 2.2.1 interrupt functions (1) external 0 interrupt (int0) the interrupt request occurs by the change of input level of int0 pin. the interrupt valid waveform can be selected by the bits 1 and 2, and the int0 pin input is controlled by the bit 3 of the interrupt control register i1. external 0 interrupt int0 processing when the interrupt is used the interrupt occurrence is enabled when the bit 0 of the interrupt control register v1 and the interrupt enable flag inte are set to 1. when the external 0 interrupt occurs, the interrupt processing is executed from address 0 in page 1. when the interrupt is not used the interrupt is disabled and the snz0 instruction is valid when the bit 0 of register v1 is set to 0. (2) external 1 interrupt (int1) the interrupt request occurs by the change of input level of int1 pin. the interrupt valid waveform can be selected by the bits 1 and 2, and the int1 pin input is controlled by the bit 3 of the interrupt control register i2. external 1 interrupt int1 processing when the interrupt is used the interrupt occurrence is enabled when the bit 1 of the interrupt control register v1 and the interrupt enable flag inte are set to 1. when the external 1 interrupt occurs, the interrupt processing is executed from address 2 in page 1. when the interrupt is not used the interrupt is disabled and the snz1 instruction is valid when the bit 1 of register v1 is set to 0. (3) timer 1 interrupt the interrupt request occurs by the timer 1 underflow. timer 1 interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 2 of the interrupt control register v1 and the interrupt enable flag inte are set to 1. when the timer 1 interrupt occurs, the interrupt processing is executed from address 4 in page 1. when the interrupt is not used the interrupt is disabled and the snzt1 instruction is valid when the bit 2 of register v1 is set to 0.
4519 group application 2.2 interrupts 2-16 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) timer 2 interrupt the interrupt request occurs by the timer 2 underflow. timer 2 interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 3 of the interrupt control register v1 and the interrupt enable flag inte are set to 1. when the timer 2 interrupt occurs, the interrupt processing is executed from address 6 in page 1. when the interrupt is not used the interrupt is disabled and the snzt2 instruction is valid when the bit 3 of register v1 is set to 0. (5) timer 3 interrupt the interrupt request occurs by the timer 3 underflow. timer 3 interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 0 of the interrupt control register v2 and the interrupt enable flag inte are set to 1. when the timer 3 interrupt occurs, the interrupt processing is executed from address 8 in page 1. when the interrupt is not used the interrupt is disabled and the snzt3 instruction is valid when the bit 0 of register v2 is set to 0. (6) timer 4 interrupt the interrupt request occurs by the timer 4 underflow. timer 4 interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 1 of the interrupt control register v2 and the interrupt enable flag inte are set to 1. when the timer 4 interrupt occurs, the interrupt processing is executed from address a in page 1. when the interrupt is not used the interrupt is disabled and the snzt4 instruction is valid when the bit 1 of register v2 is set to 0.
4519 group application 2.2 interrupts 2-17 rev.1.00 aug 06, 2004 rej09b0175-0100z (7) a/d interrupt the interrupt request occurs by the completion of a/d conversion. a/d interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 2 of the interrupt control register v2 and the interrupt enable flag inte are set to 1. when the a/d interrupt occurs, the interrupt processing is executed from address c in page 1. when the interrupt is not used the interrupt is disabled and the snzad instruction is valid when the bit 2 of register v2 is set to 0. (8) serial i/o interrupt the interrupt request occurs by the completion of serial i/o transmit/receive. serial i/o interrupt processing when the interrupt is used the interrupt occurrence is enabled when the bit 3 of the interrupt control register v2 and the interrupt enable flag inte are set to 1. when the serial i/o interrupt occurs, the interrupt processing is executed from address e in page 1. when the interrupt is not used the interrupt is disabled and the snzsi instruction is valid when the bit 3 of register v2 is set to 0.
4519 group application 2.2 interrupts 2-18 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.2.2 related registers (1) interrupt enable flag (inte) the interrupt enable flag (inte) controls whether the every interrupt enable/disable. interrupts are enabled when inte flag is set to 1 with the ei instruction and disabled when inte flag is cleared to 0 with the di instruction. when any interrupt occurs while the inte flag is 1 , the inte flag is automatically cleared to 0, so that other interrupts are disabled until the ei instruction is executed. note: the interrupt enabled with the ei instruction is performed after the ei instruction and one more instruction. (2) interrupt request flag the activated condition for each interrupt is examined. each interrupt request flag is set to 1 when the activated condition is satisfied, even if the interrupt is disabled by the inte flag or its interrupt enable bit. each interrupt request flag is cleared to 0 when either; an interrupt occurs, or the next instruction is skipped with a skip instruction. (3) interrupt control register v1 table 2.2.1 shows the interrupt control register v1. set the contents of this register through register a with the tv1a instruction. in addition, the tav1 instruction can be used to transfer the contents of register v1 to register a. table 2.2.1 interrupt control register v1 interrupt control register v1 at reset : 0000 2 at ram back-up : 0000 2 interrupt disabled ( snzt2 instruction is valid) interrupt enabled ( snzt2 instruction is invalid) ( note 2 ) interrupt disabled ( snzt1 instruction is valid) interrupt enabled ( snzt1 instruction is invalid) ( note 2 ) interrupt disabled ( snz1 instruction is valid) interrupt enabled ( snz1 instruction is invalid) ( note 2 ) interrupt disabled ( snz0 instruction is valid) interrupt enabled ( snz0 instruction is invalid) ( note 2 ) timer 2 interrupt enable bit timer 1 interrupt enable bit external 1 interrupt enable bit external 0 interrupt enable bit v1 3 v1 2 v1 1 v1 0 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: these instructions are equivalent to the nop instruction. r/w
4519 group application 2.2 interrupts 2-19 rev.1.00 aug 06, 2004 rej09b0175-0100z notes 1: ??represents read enabled, and ??represents write enabled. 2: these instructions are equivalent to the nop instruction. (5) interrupt control register i1 table 2.2.3 shows the interrupt control register i1. set the contents of this register through register a with the ti1a instruction. in addition, the tai1 instruction can be used to transfer the contents of register i1 to register a. table 2.2.3 interrupt control register i1 interrupt control register v2 at reset : 0000 2 at ram back-up : 0000 2 r/w interrupt disabled ( snzsi instruction is valid) interrupt enabled ( snzsi instruction is invalid) ( note 2 ) interrupt disabled ( snzad instruction is valid) interrupt enabled ( snzad instruction is invalid) ( note 2 ) interrupt disabled ( snzt4 instruction is valid) interrupt enabled ( snzt4 instruction is invalid) ( note 2 ) interrupt disabled ( snzt3 instruction is valid) interrupt enabled ( snzt3 instruction is invalid) ( note 2 ) serial i/o interrupt enable bit ( note 2 ) a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit v2 3 v2 2 v2 1 v2 0 0 1 0 1 0 1 0 1 (4) interrupt control register v2 table 2.2.2 shows the interrupt control register v2. set the contents of this register through register a with the tv2a instruction. in addition, the tav2 instruction can be used to transfer the contents of register v2 to register a. table 2.2.2 interrupt control register v2 interrupt control register i1 at reset : 0000 2 at ram back-up : state retained int0 pin input disabled int0 pin input enabled falling waveform /??level (??level is recognized with the snzi0 instruction) rising waveform /??level (??level is recognized with the snzi0 instruction) one-sided edge detected both edges detected timer 1 count start synchronous circuit not selected timer 1 count start synchronous circuit selected int0 pin input control bit ( note 2 ) interrupt valid waveform for int0 pin/return level selection bit ( note 2 ) int0 pin edge detection circuit control bit int0 pin timer 1 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i1 3 i1 2 i1 1 i1 0 notes 1: ??represents read enabled, and ??represents write enabled. 2: when the contents of i1 2 and i1 3 are changed, the external interrupt request flag exf0 may be set to ?? accordingly, clear exf0 flag with the snz0 instruction when the bit 0 (v1 0 ) of register v1 to ?? in this time, set the nop instruction after the snz0 instruction, for the case when a skip is performed with the snz0 instruction. r/w
4519 group application 2.2 interrupts 2-20 rev.1.00 aug 06, 2004 rej09b0175-0100z interrupt control register i2 at reset : 0000 2 at ram back-up : state retained int1 pin input disabled int1 pin input enabled falling waveform / l level ( l level is recognized with the snzi1 instruction) rising waveform / h level ( h level is recognized with the snzi1 instruction) one-sided edge detected both edges detected timer 3 count start synchronous circuit not selected timer 3 count start synchronous circuit selected int1 pin input control bit ( note 2 ) interrupt valid waveform for int1 pin/return level selection bit ( note 2 ) int1 pin edge detection circuit control bit int1 pin timer 3 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i2 3 i2 2 i2 1 i2 0 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i2 2 and i2 3 are changed, the external interrupt request flag exf1 may be set to 1 . accordingly, clear exf1 flag with the snz1 instruction when the bit 1 (v1 1 ) of register v1 to 0 . in this time, set the nop instruction after the snz1 instruction, for the case when a skip is performed with the snz1 instruction. (6) interrupt control register i2 table 2.2.4 shows the interrupt control register i2. set the contents of this register through register a with the ti2a instruction. in addition, the tai2 instruction can be used to transfer the contents of register i2 to register a. table 2.2.4 interrupt control register i2 r/w
4519 group application 2.2 interrupts 2-21 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.2.3 interrupt application examples (1) external 0 interrupt the int0 pin is used for external 0 interrupt, of which valid waveforms can be chosen, which can recognize the change of falling edge ( h l ), rising edge ( l h ) and both edges ( h l or l h ). outline: an external 0 interrupt can be used by dealing with the falling edge ( h l ), rising edge ( l h ) and both edges ( h l or l h ) as a trigger. specifications: an interrupt occurs by the change of an external signal edge (both edges: h l or l h ). figure 2.2.1 shows an operation example of an external 0 interrupt, and figure 2.2.2 shows a setting example of an external 0 interrupt. (2) external 1 interrupt the int1 pin is used for external 1 interrupt, of which valid waveforms can be chosen, which can recognize the change of falling edge ( h l ), rising edge ( l h ) and both edges ( h l or l h ). outline: an external 1 interrupt can be used by dealing with the falling edge ( h l ), rising edge ( l h ) and both edges ( h l or l h ) as a trigger. specifications: an interrupt occurs by the change of an external signal edge (falling edge: h l ). figure 2.2.3 shows an operation example of an external 1 interrupt, and figure 2.2.4 shows a setting example of an external 1 interrupt. (3) timer 1 interrupt constant period interrupts by a setting value to timer 1 can be used. outline: the constant period interrupts by the timer 1 underflow signal can be used. specifications: timer 1 divides the system clock frequency = 2.0 mhz, and the timer 1 interrupt occurs every 0.25 ms. figure 2.2.5 shows a setting example of the timer 1 constant period interrupt. (4) timer 2 interrupt constant period interrupts by a setting value to timer 2 can be used. outline: the constant period interrupts by the timer 2 underflow signal can be used. specifications: timer 2 and prescaler divide the system clock frequency (= 4.0 mhz), and the timer 2 interrupt occurs every 1 ms. figure 2.2.6 shows a setting example of the timer 2 constant period interrupt.
4519 group application 2.2 interrupts 2-22 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) timer 3 interrupt constant period interrupts by a setting value to timer 3 can be used. outline: the constant period interrupts by the timer 3 underflow signal can be used. specifications: prescaler and timer 3 divide the system clock frequency = 6.0 mhz, and the timer 3 interrupt occurs every 1 ms. figure 2.2.7 shows a setting example of the timer 3 constant period interrupt. (6) timer 4 interrupt constant period interrupts by a setting value to timer 4 can be used. outline: the constant period interrupts by the timer 4 underflow signal can be used. specifications: timer 4 and prescaler divide the system clock frequency (= 4.0 mhz), and the timer 4 interrupt occurs every 50 ms. figure 2.2.8 shows a setting example of the timer 4 constant period interrupt. fig. 2.2.1 external 0 interrupt operation example p3 0 /int0 p3 0 /int0 h h l l an interrupt occurs after the valid waveform falling is detected. an interrupt occurs after the valid waveform rising is detected.
4519 group application 2.2 interrupts 2-23 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.2 external 0 interrupt setting example note: the valid waveforms causing the interrupt must be retained at their level for 4 cycles or more of system clock. ? disable interrupts external 0 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ??? 0 b0: external 0 interrupt occurrence disabled [ tv1a ] ? set port port used for external 0 interrupt is set to input port. b3 b0 port p3 0 output latch ??? 1 set to input [ op3a ] ? set valid waveform valid waveform of int0 pin is selected. b3 b0 [ ti1a ] interrupt control register i1 1 ? 1 ? b3: int0 pin input enabled b1: both edges detection selected ? execute nop instruction [ nop ] ? clear interrupt request external 0 interrupt activated condition is cleared. external 0 interrupt request flag exf0 0 external 0 interrupt activated condition cleared [ snz0 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag exf0, insert the nop instruction after the snz0 instruction. ? enable interrupts the external 0 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ??? 1 b0: external 0 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] external 0 interrupt enabled state ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.2 interrupts 2-24 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.3 external 1 interrupt operation example p3 1 /int1 p3 1 /int1 h h l l an interrupt occurs after the valid waveform falling is detected.
4519 group application 2.2 interrupts 2-25 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.4 external 1 interrupt setting example note: the valid waveforms causing the interrupt must be retained at their level for 4 cycles or more of system clock. ? disable interrupts external 1 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ?? 0 ? b1: external 1 interrupt occurrence disabled [ tv1a ] ? set port port used for external 1 interrupt is set to input port. b3 b0 port p3 1 output latch ?? 1 ? set to input [ op3a ] ? set valid waveform valid waveform of int1 pin is selected. b3 b0 [ ti2a ] interrupt control register i2 1 0 0 ? b3: int1 pin input enabled b2, b1: one-sided edge detection and falling waveform selected ? execute nop instruction [ nop ] ? clear interrupt request external 1 interrupt activated condition is cleared. external 1 interrupt request flag exf1 0 external 1 interrupt activated condition cleared [ snz1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag exf1, insert the nop instruction after the snz1 instruction. ? enable interrupts the external 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ?? 1 ? b1: external 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] external 1 interrupt enabled state ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.2 interrupts 2-26 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.5 timer 1 constant period interrupt setting example ? disable interrupts timer 1 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop timer operation timer 1 is temporarily stopped. [ tw1a ] timer 1 count source is selected. b3: timer 1 count auto-stop circuit not selected b3 b0 b2: timer 1 stop timer control register w1 0 0 0 0 b1, b0: instruction clock (instck) selected for timer 1 count source ? set timer value timer 1 count time is set. (the formula is shown *a below.) timer 1 reload register r1 a6 16 timer count value 166 set [ t1ab ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? start timer operation timer 1 temporarily stopped is restarted. b3 b0 timer control register w1 0 1 0 0 b2: timer 1 operation start [ tw1a ] ? enable interrupts the timer 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ? 1 ?? b2: timer 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] constant period interrupt execution started *a: the timer 1 count value to make the interrupt occur every 0.25 ms is set as follows. 0.25 ms ? (2.0 mhz) -1 ? 3 ? (166+1) ? : it can be 0 or 1. [ ] : instruction () system clock instruction clock timer 1 count value
4519 group application 2.2 interrupts 2-27 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.6 timer 2 constant period interrupt setting example ? disable interrupts timer 2 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 0 ??? b3: timer 2 interrupt occurrence disabled [ tv1a ] ? stop timer and prescaler operation timer 2 and prescaler are temporarily stopped. timer 2 count source is selected. [ tw2a ] b3 b0 b2: timer 2 stop timer control register w2 ? 0 0 1 b1, b0: prescaler output (orclk) selected for b0 timer 2 count source timer control register pa 0 prescaler stop [ tpaa ] ? set timer value and prescaler value timer 2 and prescaler count times are set. (the formula is shown *a below.) timer 2 reload register r2 52 16 timer count value 82 set [ t2ab ] prescaler reload register rps 0f 16 prescaler count value 15 set [ tpsab ] ? clear interrupt request timer 2 interrupt activated condition is cleared. timer 2 interrupt request flag t2f 0 timer 2 interrupt activated condition cleared [ snzt2 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t2f, insert the nop instruction after the snzt2 instruction. ? start timer operation and prescaler operation timer 2 and prescaler temporarily stopped are restarted. b3 b0 timer control register w2 ? 1 0 1 b2: timer 2 operation start [ tw2a ] b0 timer control register pa 1 prescaler start [ tpaa ] ? enable interrupts the timer 2 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 1 ??? b3: timer 2 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] constant period interrupt execution started *a: the prescaler count value and timer 2 count value to make the interrupt occur every 1 ms are set as follows. 1 ms ? (4.0 mhz) -1 ? 3 ? (15 +1) ? (82 +1) ? : it can be 0 or 1. [ ] : instruction () system clock instruction clock timer 2 count value prescaler count value
4519 group application 2.2 interrupts 2-28 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.7 timer 3 constant period interrupt setting example ? disable interrupts timer 3 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 ??? 0 b0: timer 3 interrupt occurrence disabled [ tv2a ] ? stop timer operation timer 3 and prescaler are temporarily stopped. timer 3 count source is selected. [ tw3a ] b3 b0 b3: timer 3 count auto-stop circuit not selected timer control register w3 0 0 0 1 b2: timer 3 stop b1, b0: prescaler output (orclk) selected for b0 timer 3 count source timer control register pa 0 prescaler stop [ tpaa ] ? set timer value and prescaler value timer 3 and prescaler count times are set. (the formula is shown *a below.) timer 3 reload register r3 ef 16 timer count value 239 set [ t3ab ] prescaler reload register rps f9 16 prescaler count value 249 set [ tpsab ] ? clear interrupt request timer 3 interrupt activated condition is cleared. timer 3 interrupt request flag t3f 0 timer 3 interrupt activated condition cleared [ snzt3 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t3f, insert the nop instruction after the snzt3 instruction. ? start timer operation and prescaler operation timer 3 and prescaler temporarily stopped are restarted. b3 b0 timer control register w3 0 1 0 1 b2: timer 3 operation start [ tw3a ] b0 timer control register pa 1 prescaler start [ tpaa ] ? enable interrupts the timer 3 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v2 ??? 1 b0: timer 3 interrupt occurrence enabled [ tv2a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] constant period interrupt execution started *a: the prescaler count value and timer 3 count value to make the interrupt occur every 30 ms are set as follows. 30 ms ? (6.0 mhz) -1 ? 3 ? (249 +1) ? (239 +1) ? : it can be 0 or 1. [ ] : instruction () system clock instruction clock timer 3 count value prescaler count value
4519 group application 2.2 interrupts 2-29 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.2.8 timer 4 constant period interrupt setting example ? disable interrupts timer 4 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 ?? 0 ? b1: timer 4 interrupt occurrence disabled [ tv2a ] ? stop timer and prescaler operation [ tw4a ] timer 4 and prescaler are temporarily stopped. b3: cntr1 input timer 4 count source is selected. b2: pwm signal h interval expansion function invalid b3 b0 b1: timer 4 stop timer control register w4 0001 b0: prescaler output (orclk) divided by 2 selected b0 for timer 4 count source timer control register pa 0 prescaler stop [ tpaa ] ? set timer value and prescaler value timer 4 and prescaler count times are set. (the formula is shown *a below.) timer 4 reload register r4l dd 16 timer count value 221 set [ t4ab ] prescaler reload register rps 95 16 prescaler count value 149 set [ tpsab ] ? clear interrupt request timer 4 interrupt activated condition is cleared. timer 4 interrupt request flag t4f 0 timer 4 interrupt activated condition cleared [ snzt4 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t4f, insert the nop instruction after the snzt4 instruction. ? start timer operation and prescaler operation timer 4 and prescaler temporarily stopped are restarted. b3 b0 timer control register w4 0011 b1: timer 4 operation start [ tw4a ] b0 timer control register pa 1 prescaler start [ tpaa ] ? enable interrupts the timer 4 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v2 ?? 1 ? b1: timer 4 interrupt occurrence enabled [ tv2a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] constant period interrupt execution started *a: the prescaler count value and timer 4 count value to make the interrupt occur every 50 ms are set as follows. 50 ms ? (4.0 mhz) -1 ? 3 ? (149 +1) ? 2 ? (221 +1) ? : it can be 0 or 1. [ ] : instruction () system clock instruction clock timer 4 count value prescaler count value timer 4 count source
4519 group application 2.2 interrupts 2-30 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.2.4 notes on use (1) setting of int0 interrupt valid waveform set a value to the bit 2 of register i1, and execute the snz0 instruction to clear the exf0 flag to 0 after executing at least one instruction. depending on the input state of p3 0 /int0 pin, the external interrupt request flag (exf0) may be set to 1 when the bit 2 of register i1 is changed. (2) setting of int0 pin input control set a value to the bit 3 of register i1, and execute the snz0 instruction to clear the exf0 flag to 0 after executing at least one instruction. depending on the input state of p3 0 /int0 pin, the external interrupt request flag (exf0) may be set to 1 when the bit 3 of register i1 is changed. (3) setting of int1 interrupt valid waveform set a value to the bit 2 of register i2, and execute the snz1 instruction to clear the exf1 flag to 0 after executing at least one instruction. depending on the input state of p3 1 /int1 pin, the external interrupt request flag (exf1) may be set to 1 when the bit 2 of register i2 is changed. (4) setting of int1 pin input control set a value to the bit 3 of register i2, and execute the snz1 instruction to clear the exf1 flag to 0 after executing at least one instruction. depending on the input state of p3 1 /int1 pin, the external interrupt request flag (exf1) may be set to 1 when the bit 3 of register i2 is changed. (5) multiple interrupts multiple interrupts cannot be used in the 4519 group. (6) notes on interrupt processing when the interrupt occurs, at the same time, the interrupt enable flag inte is cleared to 0 (interrupt disable state). in order to enable the interrupt at the same time when system returns from the interrupt, write ei and rti instructions continuously. (7) p3 0 /int0 pin when the external interrupt input pin int0 is used, set the bit 3 of register i1 to 1. even in this case, port p3 0 i/o function is valid. also, the exf0 flag is set to 1 when bit 3 of register i1 is set to 1 by input of a valid waveform (valid waveform causing external 0 interrupt) even if it is used as an i/o port p3 0 . the input threshold characteristics (v ih /v il ) are different between int0 pin input and port p3 0 input. accordingly, note this difference when int0 pin input and port p3 0 input are used at the same time. (8) p3 1 /int1 pin when the external interrupt input pin int1 is used, set the bit 3 of register i2 to 1. even in this case, port p3 1 i/o function is valid. also, the exf1 flag is set to 1 when bit 3 of register i2 is set to 1 by input of a valid waveform (valid waveform causing external 1 interrupt) even if it is used as an i/o port p3 1 . the input threshold characteristics (v ih /v il ) are different between int1 pin input and port p3 1 input. accordingly, note this difference when int1 pin input and port p3 1 input are used at the same time. (9) pof instruction when the pof instruction is executed continuously after the epof instruction, system enters the ram back-up state. note that system cannot enter the ram back-up state when executing only the pof instruction. be sure to disable interrupts by executing the di instruction before executing the epof instruction and the pof instruction continuously.
4519 group application 2.3 timers 2-31 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.3 timers the 4519 group has four 8-bit timers (each has a reload register) and the watchdog timer function. this section describes individual types of timers, related registers, application examples using timers and notes. 2.3.1 timer functions (1) timer 1 timer operation (timer 1 has the timer 1 count start trigger function from p3 0 /int0 pin input) (2) timer 2 timer operation (3) timer 3 timer operation (timer 3 has the timer 3 count start trigger function from p3 1 /int1 pin input) (4) timer 4 timer operation (timer 4 has the pwm output function) (5) watchdog timer watchdog function watchdog timer provides a method to reset the system when a program run-away occurs. system operates after it is released from reset. when the timer count value underflows, the wdf1 flag is set to 1. then, if the wrst instruction is never executed until timer wdt counts 65534, wdf2 flag is set to 1, and system reset occurs. when the dwdt instruction and the wrst instruction are executed continuously, the watchdog timer function is invalid. the wrst instruction has the skip function. when the wrst instruction is executed while the wdf1 flag is 1 , the next instruction is skipped and then, the wdf1 flag is cleared to 0 .
4519 group application 2.3 timers 2-32 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.3.2 related registers (1) interrupt control register v1 table 2.3.1 shows the interrupt control register v1. set the contents of this register through register a with the tv1a instruction. in addition, the tav1 instruction can be used to transfer the contents of register v1 to register a. table 2.3.1 interrupt control register v1 interrupt control register v1 at reset : 0000 2 at ram back-up : 0000 2 r/w interrupt disabled ( snzt2 instruction is valid) interrupt enabled ( snzt2 instruction is invalid) ( note 2 ) interrupt disabled ( snzt1 instruction is valid) interrupt enabled ( snzt1 instruction is invalid) ( note 2 ) interrupt disabled ( snz1 instruction is valid) interrupt enabled ( snz1 instruction is invalid) ( note 2 ) interrupt disabled ( snz0 instruction is valid) interrupt enabled ( snz0 instruction is invalid) ( note 2 ) timer 2 interrupt enable bit timer 1 interrupt enable bit external 1 interrupt enable bit external 0 interrupt enable bit v1 3 v1 2 v1 1 v1 0 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: these instructions are equivalent to the nop instruction. 3: when timer is used, v1 1 and v1 0 are not used. (2) interrupt control register v2 table 2.3.2 shows the interrupt control register v2. set the contents of this register through register a with the tv2a instruction. in addition, the tav2 instruction can be used to transfer the contents of register v2 to register a. table 2.3.2 interrupt control register v2 interrupt control register v2 at reset : 0000 2 at ram back-up : 0000 2 r/w interrupt disabled ( snzsi instruction is valid) interrupt enabled ( snzsi instruction is invalid) ( note 2 ) interrupt disabled ( snzad instruction is valid) interrupt enabled ( snztad instruction is invalid) ( note 2 ) interrupt disabled ( snzt4 instruction is valid) interrupt enabled ( snzt4 instruction is invalid) ( note 2 ) interrupt disabled ( snzt3 instruction is valid) interrupt enabled ( snzt3 instruction is invalid) ( note 2 ) serial i/o interrupt enable bit a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit v2 3 v2 2 v2 1 v2 0 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: these instructions are equivalent to the nop instruction. 3: when timer is used, v2 3 and v2 2 is not used.
4519 group application 2.3 timers 2-33 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) interrupt control register i1 table 2.3.3 shows the interrupt control register i1. set the contents of this register through register a with the ti1a instruction. in addition, the tai1 instruction can be used to transfer the contents of register i1 to register a. table 2.3.3 interrupt control register i1 interrupt control register i1 at reset : 0000 2 at ram back-up : state retained int0 pin input disabled int0 pin input enabled falling waveform/ l level ( l level is recognized with the snzi0 instruction) rising waveform/ h level ( h level is recognized with the snzi0 instruction) one-sided edge detected both edges detected timer 1 count start synchronous circuit not selected timer 1 count start synchronous circuit selected int0 pin input control bit ( note 2 ) interrupt valid waveform for int0 pin/return level selection bit ( note 2 ) int0 pin edge detection circuit control bit int0 pin timer 1 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i1 3 i1 2 i1 1 i1 0 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i1 2 and i1 3 are changed, the external interrupt request flag exf0 may be set. accordingly, clear exf0 flag with the snz0 instruction when the bit 0 (v1 0 ) of register v1 to 0 . in this time, set the nop instruction after the snz0 instruction, for the case when a skip is performed with the snz0 instruction. (4) interrupt control register i2 table 2.3.4 shows the interrupt control register i2. set the contents of this register through register a with the ti2a instruction. in addition, the tai2 instruction can be used to transfer the contents of register i2 to register a. table 2.3.4 interrupt control register i2 r/w interrupt control register i2 at reset : 0000 2 at ram back-up : state retained int1 pin input disabled int1 pin input enabled falling waveform/ l level ( l level is recognized with the snzi1 instruction) rising waveform/ h level ( h level is recognized with the snzi1 instruction) one-sided edge detected both edges detected timer 3 count start synchronous circuit not selected timer 3 count start synchronous circuit selected int1 pin input control bit ( note 2 ) interrupt valid waveform for int1 pin/return level selection bit ( note 2 ) int1 pin edge detection circuit control bit int1 pin timer 3 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i2 3 i2 2 i2 1 i2 0 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i2 2 and i2 3 are changed, the external interrupt request flag exf1 may be set. accordingly, clear exf1 flag with the snz1 instruction when the bit 1 (v1 1 ) of register v1 to 0 . in this time, set the nop instruction after the snz1 instruction, for the case when a skip is performed with the snz1 instruction. r/w
4519 group application 2.3 timers 2-34 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) timer control register pa table 2.3.5 shows the timer control register pa. set the contents of this register through register a with the tpaa instruction. table 2.3.5 timer control register pa timer control register pa at reset : 0 2 at ram back-up : state retained w stop (state initialized) operating prescaler control bit 0 1 pa 0 note: w represents write enabled. (6) timer control register w1 table 2.3.6 shows the timer control register w1. set the contents of this register through register a with the tw1a instruction. in addition, the taw1 instruction can be used to transfer the contents of register w1 to register a. table 2.3.6 timer control register w1 timer control register w1 at reset : 0000 2 at ram back-up : state retained r/w timer 1 count auto-stop circuit not selected timer 1 count auto-stop circuit selected stop (state retained) operating count source instruction clock (instck) prescaler output (orclk) x in input cntr0 input timer 1 count auto-stop circuit control bit ( note 2 ) timer 1 control bit timer 1 count source selection bits w1 3 w1 2 w1 1 w1 0 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: this function is valid only when the timer 1 count start synchronous circuit is selected (i1 0 = 1 ). w1 1 0 0 1 1 w1 0 0 1 0 1 (7) timer control register w2 table 2.3.7 shows the timer control register w2. set the contents of this register through register a with the tw2a instruction. in addition, the taw2 instruction can be used to transfer the contents of register w2 to register a. table 2.3.7 timer control register w2 timer control register w2 at reset : 0000 2 at ram back-up : state retained r/w timer 1 underflow signal divided by 2 output timer 2 underflow signal divided by 2 output stop (state retained) operating count source system clock (stck) prescaler output (orclk) timer 1 underflow signal (t1udf) pwm signal (pwmout) cntr0 output selection bit timer 2 control bit timer 2 count source selection bits w2 3 w2 2 w2 1 w2 0 0 1 0 1 w2 1 0 0 1 1 w2 0 0 1 0 1 note: r represents read enabled, and w represents write enabled.
4519 group application 2.3 timers 2-35 rev.1.00 aug 06, 2004 rej09b0175-0100z (8) timer control register w3 table 2.3.8 shows the timer control register w3. set the contents of this register through register a with the tw3a instruction. in addition, the taw3 instruction can be used to transfer the contents of register w3 to register a. table 2.3.8 timer control register w3 timer control register w3 at reset : 0000 2 at ram back-up : state retained r/w timer 3 count auto-stop circuit not selected timer 3 count auto-stop circuit selected stop (state retained) operating count source pwm signal (pwmout) prescaler output (orclk) timer 2 underflow signal (t2udf) cntr1 input timer 3 count auto-stop circuit control bit ( note 2 ) timer 3 control bit timer 3 count source selection bits w3 3 w3 2 w3 1 w3 0 0 1 0 1 w3 1 0 0 1 1 w3 0 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: this function is valid only when the timer 3 count start synchronous circuit is selected (i2 0 = 1 ). (9) timer control register w4 table 2.3.9 shows the timer control register w4. set the contents of this register through register a with the tw4a instruction. in addition, the taw4 instruction can be used to transfer the contents of register w4 to register a. table 2.3.9 timer control register w4 timer control register w4 at reset : 0000 2 at ram back-up : 0000 2 r/w d 7 (i/o) / cntr1 (input) cntr1 (i/o) / d 7 (input) pwm signal h interval expansion function invalid pwm signal h interval expansion function valid stop (state retained) operating x in input prescaler output (orclk) divided by 2 d 7 /cntr1 pin function selection bit pwm signal h interval expansion function control bit timer 4 control bit timer 4 count source selection bit w4 3 w4 2 w4 1 w4 0 0 1 0 1 0 1 0 1 note: r represents read enabled, and w represents write enabled.
4519 group application 2.3 timers 2-36 rev.1.00 aug 06, 2004 rej09b0175-0100z (10) timer control register w5 table 2.3.10 shows the timer control register w5. set the contents of this register through register a with the tw5a instruction. in addition, the taw5 instruction can be used to transfer the contents of register w5 to register a. table 2.3.10 timer control register w5 timer control register w5 at reset : 0000 2 at ram back-up : state retained r/w this bit has no function, but read/write is enabled. stop operating count source on-chip oscillator (f(ring/16)) cntr 0 pin input int0 pin input not available not used period measurement circuit control bit signal for period measurement selection bits w5 3 w5 2 w5 1 w5 0 0 1 0 1 w5 1 0 0 1 1 w5 0 0 1 0 1 note: r represents read enabled, and w represents write enabled. timer control register w6 at reset : 0000 2 at ram back-up : state retained r/w falling edge rising edge falling edge rising edge cntr1 output auto-control circuit not selected cntr1 output auto-control circuit selected d 6 (i/o)/cntr0 input cntr0 input/output/d 6 (input) cntr1 pin input count edge selection bit cntr0 pin input count edge selection bit cntr1 output auto-control circuit selection bit d 6 /cntr0 pin function selection bit w6 3 w6 2 w6 1 w6 0 0 1 0 1 0 1 0 1 (11) timer control register w6 table 2.3.11 shows the timer control register w6. set the contents of this register through register a with the tw6a instruction. in addition, the taw6 instruction can be used to transfer the contents of register w6 to register a. table 2.3.11 timer control register w6 note: r represents read enabled, and w represents write enabled.
4519 group application 2.3 timers 2-37 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.3.3 timer application examples (1) timer operation: measurement of constant period the constant period by the setting timer count value can be measured. outline: the constant period by the timer 1 underflow signal can be measured. specifications: timer 1 and prescaler divide the system clock frequency f(x in ) = 4.0 mhz, and the timer 1 interrupt occurs every 3 ms. figure 2.3.4 shows the setting example of the constant period measurement. (2) cntr0 output operation: buzzer output outline: square wave output from timer 2 can be used for buzzer output. specifications: 4 khz square wave is output from the cntr0 pin at system clock frequency f(x in ) = 4.0 mhz. also, timer 2 interrupt occurs simultaneously. figure 2.3.1 shows the peripheral circuit example, and figure 2.3.5 shows the setting example of cntr0 output. fig. 2.3.1 peripheral circuit example (3) cntr0 input operation: event count outline: count operation can be performed by using the signal (rising waveform) input from cntr0 pin as the event. specifications: the low-frequency pulse from external as the timer 1 count source is input to cntr0 pin, and the timer 1 interrupt occurs every 100 counts. figure 2.3.6 shows the setting example of cntr0 input. 4519 cntr0 125 s 125 s in order to set the timer 2 underflow cycle to 125 s, set the dividing ratio. in order to reduce the current dissipation, output is high-impedance state during buzzer output stop.
4519 group application 2.3 timers 2-38 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) timer operation: timer start by external input outline: the constant period can be measured by external input. specifications: timer 3 operates by int1 input as a trigger and an interrupt occurs after 1 ms. figure 2.3.7 shows the setting example of timer start. (5) cntr1 output control: pwm output control outline: the pwm output from cntr1 pin can be performed by timer 4. specifications: timer 4 divides the main clock frequency f(x in ) = 4.0 mhz and the waveform, which h period is 0.875 s of the 1.875 s pwm periods, is output from cntr1 pin. figure 2.3.2 shows the timer 4 operation and figure 2.3.8 shows the setting example of pwm output control. fig. 2.3.2 timer 4 operation 03 16 01 16 00 16 02 16 02 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 01 16 00 16 02 16 01 16 00 16 03 16 02 16 (r4l) (r4h) (r4l) (r4h) (r4l) (r4h) pwm period 7.5 clock pwm period 7.5 clock timer 4 count source timer 4 count value (reload register) timer 4 underflow signal pwm signal timer 4 start cntr1 output: valid (w4 3 = 1 ) pwm signal h interval extension function: valid (w4 2 = 1 ) (note) reload register r4l = 03 16 reload register r4h = 02 16 note: at pwm signal h interval extension function: valid, set 01 16 or more to reload register r4h. 3.5 clock 3.5 clock (6) period measurement outline: the period of the followings can be measured by timer 1. on-chip oscillator divided by 16 cntr0 pin input int0 pin input specifications: timer 1 count is performed during one period from the rise of a cntr0 input to the next rise. timer 1 count source is x in input. figure 2.3.9 and figure 2.3.10 show the setting example of period measurement of a cntr0 pin input. (7) pulse width measurement outline: h pulse width or l pulse width of int0 pin input can be measured by timer 1. specifications: timer 1 count is performed during h pulse input from the rise of an int0 input to the next rise. timer 1 count source is x in input. figure 2.3.11 and figure 2.3.12 show the setting example of pulse width measurement of an int0 pin input.
4519 group application 2.3 timers 2-39 rev.1.00 aug 06, 2004 rej09b0175-0100z (8) watchdog timer watchdog timer provides a method to reset the system when a program run-away occurs. accordingly, when the watchdog timer function is set to be valid, execute the wrst instruction at a certain period which consists of 16-bit timers 65534 counts or less (execute wrst instruction at less than 65534 machine cycles). outline: execute the wrst instruction in 16-bit timer s 65534 counts at the normal operation. if a program runs incorrectly, the wrst instruction is not executed and system reset occurs. specifications: system clock frequency f(x in ) = 4.0 mhz is used, and program run-away is detected by executing the wrst instruction in 49 ms. figure 2.3.3 shows the watchdog timer function, and figure 2.3.13 shows the example of watchdog timer. fig. 2.3.3 watchdog timer function 6 5 5 3 4 c o u n t ( n o t e ) v a l u e o f 1 6 - b i t t i m e r ( w d t ) w d f 1 f l a g ? w r s t i n s t r u c t i o n e x e c u t e d ( s k i p e x e c u t e d ) r e s e t p i n o u t p u t w d f 2 f l a g ? system reset ? reset released ? a f t e r s y s t e m i s r e l e a s e d f r o m r e s e t ( = a f t e r p r o g r a m i s s t a r t e d ) , t i m e r w d t s t a r t s c o u n t d o w n . ? w h e n t i m e r w d t u n d e r f l o w o c c u r s , w d f 1 f l a g i s s e t t o 1 . ? w h e n t h e w r s t i n s t r u c t i o n i s e x e c u t e d , w d f 1 f l a g i s c l e a r e d t o 0 , t h e n e x t i n s t r u c t i o n i s s k i p p e d . ? w h e n t i m e r w d t u n d e r f l o w o c c u r s w h i l e w d f 1 f l a g i s 1 , w d f 2 f l a g i s s e t t o 1 a n d t h e w a t c h d o g r e s e t s i g n a l i s o u t p u t . ? t h e o u t p u t t r a n s i s t o r o f r e s e t p i n i s t u r n e d o n b y t h e w a t c h d o g r e s e t s i g n a l a n d s y s t e m r e s e t i s e x e c u t e d . n o t e : t h e n u m b e r o f c o u n t i s e q u a l t o t h e n u m b e r o f c y c l e b e c a u s e t h e c o u n t s o u r c e o f w a t c h d o g t i m e r i s t h e i n s t r u c t i o n c l o c k . f f f f 1 6 0000 16 ? ? ?
4519 group application 2.3 timers 2-40 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.4 constant period measurement setting example ? disable interrupts timer 1 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop timer and prescaler operation timer 1 and prescaler are temporarily stopped. [ tw1a ] timer 1 count source is selected. b3: timer 1 count auto-stop circuit not selected b3 b0 b2: timer 1 stop timer control register w1 0 0 0 1 b1, b0: prescaler output (orclk) selected for b0 timer 1 count source timer control register pa 0 prescaler stop [ tpaa ] ? set timer and prescaler values timer 1 and prescaler count times are set. (the formula is shown *a below.) timer 1 reload register r1 f9 16 timer count value 249 set [ t1ab ] prescaler reload register rps 0f 16 prescaler count value 15 set [ tpsab ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? start timer and prescaler operation timer 1 and prescaler temporarily stopped are restarted. b3 b0 timer control register w1 0 1 0 1 b2: timer 1 operation start [ tw1a ] b0 timer control register pa 1 prescaler operation start [ tpaa ] ? enable interrupts the timer 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ? 1 ?? b2: timer 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] constant period interrupt execution started *a: the prescaler count value and timer 1 count value to make the interrupt occur every 3 ms is set as follows. 3 ms = (4.0 mhz) -1 ? 3 ? (15+1) ? (249+1) ? : it can be 0 or 1. [ ] : instruction () system clock instruction clock timer 1 count value prescaler count value
4519 group application 2.3 timers 2-41 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.5 cntr0 output setting example ? disable interrupts timer 2 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 0 ??? b3: timer 2 interrupt occurrence disabled [ tv1a ] ? stop timer and prescaler operation timer 2 and prescaler are temporarily stopped. [ tw2a ] timer 2 count source and cntr0 output are selected. b3: timer 2 underflow signal divided by 2 selected for b3 b0 cntr0 output timer control register w2 1001 b2: timer 2 stop b1, b0: prescaler output (orclk) selected for b0 timer 2 count source timer control register pa 0 prescaler stop [ tpaa ] ? set cntr0 output the output structure of the cntr0 pin is set to n-channel open-drain output. b3 b0 port output structure control register fr2 ? 0 ?? b2: n-channel open-drain output selected [ tfr2a ] b3 b0 timer control register w6 ??? 1 b0: cntr0 output port set [ tw6a ] ? set timer value and prescaler value timer 2 and prescaler count times are set. (the formula is shown *a below.) timer 2 reload register r2 29 16 timer count value 41 set [ t2ab ] prescaler reload register rps 03 16 prescaler count value 3 set [ tpsab ] ? clear interrupt request timer 2 interrupt activated condition is cleared. timer 2 interrupt request flag t2f 0 timer 2 interrupt activated condition cleared [ snzt2 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t2f, insert the nop instruction after the snzt2 instruction. ? start timer operation and prescaler operation timer 2 and prescaler temporarily stopped are restarted. b3 b0 timer control register w2 1101 b2: timer 2 operation start [ tw2a ] b0 timer control register pa 1 prescaler start [ tpaa ] enable interrupts the timer 2 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 1 ??? b3: timer 2 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] buzzer output start . . . ? stop cntr0 output cntr0 i/o port is set to cntr0 input port and is set to be high-impedance state. b3 b0 register y 0110 specify bit position of port d [ tya ] port d 6 output latch 1 set to input [ sd ] b3 b0 timer control register w6 ??? 0 b0: set to cntr0 input port [ tw6a ] *a: the prescaler count value and timer 2 count value to make the underflow occur every 125 s are set as follows. 125 s ? (4.0 mhz) -1 ? 3 ? (3 +1) ? (41 +1) ? : it can be 0 or 1. [ ] : instruction ( ) system clock instruction clock timer 2 count value presclaer count value
4519 group application 2.3 timers 2-42 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.6 cntr0 input setting example however, specify the pulse width input to cntr0 pin, cntr1 pin. refer to section 3.1 electrical characteristics for the timer external input period condition. ? disable interrupts timer 1 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop timer operation timer 1 is temporarily stopped. timer 1 count source is selected. [ tw1a ] b3 b0 b2: timer 1 stop timer control register w1 0 0 1 1 b1, b0: cntr0 input for timer 1 count source ? set port cntr0 i/o port is set to cntr0 input port. b3 b0 register y 0 1 1 0 specify bit position of port d [ tya ] port d 6 output latch 1 set to input [ sd ] b3 b0 port output structure control register fr2 ? 0 ?? b2: n-channel open-drain output selected [ tfr2a ] b3 b0 timer control register w6 ? 1 ? 0 b2: set count edge to rising [ tw6a ] b0: set to cntr0 input port ? set timer values timer 1 count time is set. timer 1 reload register r1 63 16 timer count value 99 set [ t1ab ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? start timer operation timer 1 temporarily stopped is restarted. b3 b0 timer control register w1 0 1 1 1 b2: timer 1 operation start [ tw1a ] enable interrupts the timer 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ? 1 ?? b2: timer 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] input signal count started ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.3 timers 2-43 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.7 timer start by external input setting example ? disable interrupts timer 3 interrupt and external interrupt are temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ?? 0 ? b1: external 1 interrupt occurrence disabled [ tv1a ] b3 b0 interrupt control register v2 ??? 0 b0: timer 3 interrupt occurrence disabled [ tv2a ] ? initialize valid waveform [ ti2a ] int1 pin is initialized. b3: int1 pin input disabled b3 b0 b2: rising waveform interrupt control register i2 0100 b1: one-sided edge detected b0: timer 3 count start synchronous circuit not selected ? stop timer 3 and prescaler operation timer 3 and prescaler are temporarily stopped. [ tw3a ] timer 3 count source is selected. b3: timer 3 count auto-stop circuit not selected b3 b0 b2: timer 3 stop timer control register w3 0001 b1, b0: prescaler output (orclk) selected for b0 timer 3 count source timer control register pa 0 prescaler stop [ tpaa ] ? set port int1 pin is set to input. b3 b0 port p3 1 output latch ?? 1 ? set to input [ op3a ] ? set timer value and prescaler value timer 3 and prescaler count times are set. (the formula is shown *a below.) timer 3 reload register r3 52 16 timer count value 82 set [ t3ab ] prescaler reload register rps 0f 16 prescaler count value 15 set [ tpsab ] ? clear interrupt request timer 3 interrupt activated condition is cleared. timer 3 interrupt request flag t3f 0 timer 3 interrupt activated condition cleared [ snzt3 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t3f, insert the nop instruction after the snzt3 instruction. set int1 input int1 pin input is set to be valid. b3 b0 b3: int1 pin input enabled [ ti2a ] interrupt control register i2 1101 b0: timer 3 count start synchronous circuit selected ? start timer operation and prescaler operation timer 3 and prescaler temporarily stopped are restarted. [ tw3a ] timer 3 count auto-stop circuit is selected. b3 b0 b3: timer 3 count auto-stop circuit selected timer control register w3 1101 b2: timer 3 operation start b0 timer control register pa 1 prescaler start [ tpaa ] ? enable interrupts the timer 3 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v2 ??? 1 b0: timer 3 interrupt occurrence enabled [ tv2a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] ready for timer start by external input completed *a: the prescaler count value and timer 3 count value to make the interrupt occur every 1 ms are set as follows. 1 ms ? (4.0 mhz) -1 ? 3 ? (15 +1) ? (82 +1) ? : it can be 0 or 1. [ ] : instruction ( ) system clock instruction clock timer 3 count value presclaer count value
4519 group application 2.3 timers 2-44 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.8 pwm output control setting example ? disable interrupts ( note 1 ) timer 4 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 ?? 0 ? b1: timer 4 interrupt occurrence disabled [ tv2a ] ? stop timer operation timer 4 is temporarily stopped. timer 4 count source is selected. [ tw4a ] pwm signal h interval expansion function control is set. b2: pwm signal h interval expansion function valid b3 b0 b1: timer 4 stop timer control register w4 0 1 0 0 b0: x in selected for timer 4 count source ? set port pwm signal output from cntr1 pin is set. b3 b0 timer control register w6 ?? 0 ? b1: cntr1 output auto-control circuit not selected [ tw6a ] b3 b0 register y 0 0 1 1 specify bit position of port d [ tya ] port d 7 output latch 0 set to l output [ rd ] b3 b0 port output structure control register fr2 1 ??? b3: port d 7 cmos output selected [ tfr2a ] ? set timer value timer 4 count time is set. timer 4 reload register r4l 03 16 timer count value 3 set [ t4ab ] timer 4 reload register r4h 02 16 timer count value 2 set [ t4hab ] ? start timer operation timer 4 temporarily stopped is restarted. [ tw4a ] cntr1 output control is set to be valid. b3 b0 b3: cntr1 output valid timer control register w4 1 1 1 0 b1: timer 4 operation start ? set interrupts ( note 1 ) interrupts except timer 4 interrupt is enabled. [ ei ] pwm output started ? : it can be 0 or 1. [ ] : instruction
4519 group application 2.3 timers 2-45 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.9 period measurement of cntr0 pin input setting example (1) ? disable interrupts timer 1 interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop timer operation timer 1 interrupt is temporarily disabled. timer 1 count time is set. [ tw1a ] b3 b0 b2: timer 1 stop timer control register w1 0 0 1 0 b1, b0: x in input for timer 1 count source ? select period measurement signal cntr i/o port is set as a cntr input port. cntr0 pin input is selected as the period measurement signal. b3 b0 register y 0 0 1 1 specify bit position of port d [ tya ] port d 6 output latch 1 set to h input [ sd ] b3 b0 [ tfr2a ] port output structure control register fr2 ? 0 ?? b2: port d 6 n-channel open-drain output selected b3 b0 [ tw6a ] timer control register w6 ? 1 ? 0 b2: select rising edge b0: set cntr0 input port b3 b0 [ tw5a ] timer control register w5 ? 0 0 1 b2: period measurement circuit stop b1, b0: cntr0 pin input for period measurement signal ? no select timer 1 count start synchronous circuit timer 1 count start synchronous circuit is set to be not selected . b3 b0 [ ti1a ] interrupt control register i1 ??? 0 b0: timer 1 count start synchronous circuit not selected ? set timer value timer 1 count time is set. timer 1 reload register r1 ff 16 timer count value 255 set [ t1ab ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? start period measurement circuit the period measurement circuit operation is started. b3 b0 timer control register w5 ? 1 0 1 b2: period measurement circuit operating [ tw5a ] ? start timer operation timer 1 temporarily stopped is restarted. b3 b0 timer control register w1 0 1 1 0 b2: timer 1 operation start [ tw1a ] ? enable interrupts the timer 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ? 1 ?? b1: timer 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] timer 1 count started, synchronizing with a fall of cntr0 pin input ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.3 timers 2-46 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.10 period measurement of cntr0 pin input setting example (2) timer 1 interrupt occurrence (period measurement completed) ? stop timer operation timer 1 interrupt is disabled. b3 b0 [ tw1a ] timer control register w1 0010 b2: timer 1 stop ? disable interrupts timer 1 interrupt is disabled. b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop period measurement circuit period measurement circuit is stopped. b3 b0 timer control register w5 ? 0 0 1 b2: period measurement circuit stop [ tw5a ] ? execute nop instruction [ nop ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? measurement data processing timer 1 count value is read out. timer 1 register a, register b [ tab1 ] ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.3 timers 2-47 rev.1.00 aug 06, 2004 rej09b0175-0100z ? disable interrupts timer 1 interrupt and external 0 interrupt are temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v1 ? 0 ? 0 b2, b0: timer 1 interrupt and external 0 interrupt occurrence disabled [ tv1a ] ? stop timer operation timer 1 interrupt is temporarily disabled. timer 1 count source is set. [ tw1a ] b3 b0 b2: timer 1 stop timer control register w1 0 0 1 0 b1, b0: x in input for timer 1 count source ? select period measurement signal p3 0 /int0 pin is set as an input port. int0 pin input is enabled and both edges detection are set. int0 pin input is selected for period measurement signal.. b3 b0 port p3 0 output latch ??? 1 set to input [ op3a ] b3 b0 [ ti1a ] interrupt control register i1 1 0 1 0 b3: int0 pin input enabled b2: l level is recognized with the snzi0 instruction b1: both edges selected b0: timer 1 count start synchronous circuit not selected b3 b0 timer control register w5 ? 0 1 0 b2: period measurement circuit stop [ tw5a ] b1, b0: int0 pin input for period measurement signal ? clear interrupt request (execute this after executing at least one instruction from ? is executed.) external 0 interrupt activated condition is cleared. external 0 interrupt request flag exf0 0 external 0 interrupt activated condition cleared [ snz0 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag exf0, insert the nop instruction after the snz0 instruction. ? set timer value timer 1 count time is set. timer 1 reload register r1 ff 16 timer count value 255 set [ t1ab ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? check input level of int0 pin to measure h pulse width whether an input level of int0 pin is l is checked. [ snzi0 ] ? start period measurement circuit if an input level of int0 pin is l , the period measurement circuit operation is started. b3 b0 timer control register w5 ? 1 1 0 b2: period measurement circuit operating [ tw5a ] ? start timer operation timer 1 temporarily stopped is restarted. b3 b0 timer control register w1 0 1 1 0 b2: timer 1 operation start [ tw1a ] ? enable interrupts the timer 1 interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v1 ? 1 ?? b2: timer 1 interrupt occurrence enabled [ tv1a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] timer 1 count started, synchronizing with a rise of int0 pin input ? : it can be 0 or 1. [ ] : instruction () () fig. 2.3.11 pulse width measurement of int0 pin input setting example (1)
4519 group application 2.3 timers 2-48 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.12 pulse width measurement of int0 pin input setting example (2) timer 1 interrupt occurrence (period measurement completed) ? stop timer operation timer 1 interrupt is disabled. b3 b0 [ tw1a ] timer control register w1 0010 b2: timer 1 stop ? disable interrupts timer 1 interrupt is disabled. b3 b0 interrupt control register v1 ? 0 ?? b2: timer 1 interrupt occurrence disabled [ tv1a ] ? stop period measurement circuit period measurement circuit is stopped. b3 b0 timer control register w5 ? 0 1 0 b2: period measurement circuit stop [ tw5a ] ? execute nop instruction [ nop ] ? clear interrupt request timer 1 interrupt activated condition is cleared. timer 1 interrupt request flag t1f 0 timer 1 interrupt activated condition cleared [ snzt1 ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the interrupt request flag t1f, insert the nop instruction after the snzt1 instruction. ? measurement data processing timer 1 count value is read out. timer 1 register a, register b [ tab1 ] ? : it can be 0 or 1. [ ] : instruction ()
4519 group application 2.3 timers 2-49 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.13 watchdog timer setting example main routine (every 20 ms) ? reset flag wdf1 watchdog timer flag wdf1 is reset. 0 watchdog timer flag wdf1 cleared. [ wrst ] note when the watchdog timer flag is cleared when ? is executed, considering the skip of the next instruction according to the watchdog timer flag wdf1, insert the nop instruction after the wrst instruction. main routine execution repeat in the interrupt service routine, do not clear watchdog timer flag wdf1. interrupt may be executed even if program run-away occurs. when going to ram back-up mode : : wrst ; wdf flag cleared nop di ; interrupt disabled epof ; pof instruction enabled pof oscillation stop (ram back-up mode) in the ram back-up mode, wef, wdf1 and wdf2 flags are initialized. however, when wdf2 flag is set to 1 , at the same time, system goes into ram back-up mode, microcomputer may be reset. when watchdog timer and ram back-up mode are used, execute the wrst instruction to initialize wdf1 flag before system goes into the ram back-up mode. ()
4519 group application 2.3 timers 2-50 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.3.4 notes on use (1) prescaler stop counting and then execute the tabps instruction to read from prescaler data. stop counting and then execute the tpsab instruction to set prescaler data. (2) count source stop timer 1, 2, 3, 4 or lc counting to change its count source. (3) reading the count values stop timer 1, 2, 3 or 4 counting and then execute the tab1 , tab2 , tab3 or tab4 instruction to read its data. (4) writing to the timer stop timer 1, 2, 3, 4 or lc counting and then execute the t1ab , t2ab , t3ab , t4ab or tlca instruction to write its data. (5) writing to reload register r1, reload register r3 and reload register r4h when writing data to reload register r1 while timer 1 is operating respectively, avoid a timing when timer 1 underflows. when writing data to reload register r3 while timer 3 is operating respectively, avoid a timing when timer 3 underflows. when writing data to reload register r4h while timer 4 is operating respectively, avoid a timing when timer 4 underflows. (6) timer 4 at cntr1 output vaild, if a timing of timer 4 underflow overlaps with a timing to stop timer 4, a hazard may be generated in a cntr1 output waveform. please review sufficiently. when h interval extension function of the pwm signal is set to be valid, set 01 16 or more to reload register r4h. (7) watchdog timer the watchdog timer function is valid after system is released from reset. when not using the watchdog timer function, stop the watchdog timer function and execute the dwdt instruction, the wrst instruction continuously, and clear the wef flag to 0. the watchdog timer function is valid after system is returned from the ram back-up state. when not using the watchdog timer function, stop the watchdog timer function and execute the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up state. when the watchdog timer function and ram back-up function are used at the same time, initialize the flag wdf1 with the wrst instruction before system enters into the ram back-up state. (8) pulse width input to cntr0 pin, cntr1 pin refer to section 3.1 electrical characteristics for rating value of pulse width input to cntr0 pin, cntr1 pin. (9) period measurement circuit
4519 group application 2.3 timers 2-51 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.3.14 period measurement circuit program example [ nop ] [ snzt1 ] snzt1 instruction, insert the nop instruction. tab1 ] ? ? ? ? ? ? ? ? fig. 2.3.15 count start time and count time when operation starts (ps, t1, t2 and t3) fig. 2.3.16 count start time and count time when operation starts (t4) (10) prescaler, timer 1, timer 2 and timer 3 count start time and count time when operation starts count starts from the first rising edge of the count source ? ? ? ? (11) timer 4 count start time and count time when operation starts count starts from the rising edge ? ? ? ?
4519 group application 2.4 a/d converter 2-52 rev.1.00 aug 06, 2004 rej09b0175-0100z v ss v dd iap4 (p4 0 p4 3 ) iap6 (p6 0 p6 3 ) op4a (p4 0 p4 3 ) op6a (p6 0 p6 3 ) tabad q1 3 q2 1 q2 0 q2 2 tadab q1 2 q1 1 q1 0 0 1 4 4 4 4 8 8 8 01 1 8 10 q1 3 q1 3 0 1 q1 3 8 8 2 tala q1 3 q2 3 taq2 tq2a taq1 tq1a adf (1) p6 0 /a in0 p4 0 /a in4 p4 1 /a in5 p4 2 /a in6 p4 3 /a in7 3 1 0 10 p6 1 /a in1 p6 2 /a in2 p6 3 /a in3 4 4 q3 1 q3 0 q3 2 q3 3 taq3 tq3a 4 (note 1) register a (4) register b (4) dac operation signal comparator 8-channel multi-plexed analog switch instruction clock a/d control circuit successive comparison register (ad) (10) a/d interrupt comparator register (8) notes 1: this switch is turned on only when a/d converter is operating and generates the comparison voltage. 2: writing/reading data to the comparator register is possible only in the comparator mode (q1 3 =1). the value of the comparator register is retained even when the mode is switched to the a/d conversion mode (q1 3 =0) because it is separated from the successive comparison register (ad). also, the resolution in the comparator mode is 8 bits because the comparator register consists of 8 bits. (note 2) 11 q3 1 , q3 0 10 01 00 0 1 q3 2 on-chip oscillator clock a/d conversion clock (adck) division circuit divided by 48 divided by 24 divided by 12 divided by 6 d/a converter 2.4 a/d converter the 4519 group has an 8-channel a/d converter with the 10-bit successive comparison method. this a/d converter can also be used as a comparator to compare analog voltages input from the analog input pin with preset values. this section describes the related registers, application examples using the a/d converter and notes. figure 2.4.1 shows the a/d converter block diagram. fig. 2.4.1 a/d converter structure
4519 group application 2.4 a/d converter 2-53 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.4.1 related registers (1) interrupt control register v2 table 2.4.1 shows the interrupt control register v2. set the contents of this register through register a with the tv2a instruction. in addition, the tav2 instruction can be used to transfer the contents of register v2 to register a. table 2.4.1 interrupt control register v2 a/d control register q1 at reset : 0000 2 at ram back-up : state retained r/w a/d operation mode control bit analog input pin selection bits q1 3 0 1 q1 2 0 0 0 0 1 1 1 1 a/d conversion mode comparator mode q1 1 0 0 1 1 0 0 1 1 analog input pins a in0 a in1 a in2 a in3 a in4 a in5 a in6 a in7 notes 1: r represents read enabled, and w represents write enabled. 2: these instructions are equivalent to the nop instruction. 3: when setting the a/d converter, v2 3 , v2 1 and v2 0 are not used. (2) a/d control register q1 table 2.4.2 shows the a/d control register q1. set the contents of this register through register a with the tq1a instruction. in addition, the taq1 instruction can be used to transfer the contents of register q1 to register a. table 2.4.2 a/d control register q1 interrupt control register v2 at reset : 0000 2 at ram back-up : 0000 2 r/w interrupt disabled ( snzsi instruction is valid) interrupt enabled ( snzsi instruction is invalid) ( note 2 ) interrupt disabled ( snzad instruction is valid) interrupt enabled ( snzad instruction is invalid) ( note 2 ) interrupt disabled ( snzt4 instruction is valid) interrupt enabled ( snzt4 instruction is invalid) ( note 2 ) interrupt disabled ( snzt3 instruction is valid) interrupt enabled ( snzt3 instruction is invalid) ( note 2 ) serial i/o interrupt enable bit ( note 2 ) a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit v2 3 v2 2 v2 1 v2 0 0 1 0 1 0 1 0 1 notes 1: r represents read enabled, and w represents write enabled. 2: in order to select a in7 a in0 , set register q1 after setting regsiter q2. q1 0 0 1 0 1 0 1 0 1 q1 2 q1 1 q1 0
4519 group application 2.4 a/d converter 2-54 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) a/d control register q2 table 2.4.3 shows the a/d control register q2. set the contents of this register through register a with the tq2a instruction. the contents of register q2 is transferred to register a with the taq2 instruction. table 2.4.3 a/d control register q2 note: r represents read enabled, and w represents write enabled. (4) a/d control register q3 table 2.4.4 shows the a/d control register q3. set the contents of this register through register a with the tq3a instruction. the contents of register q3 is transferred to register a with the taq3 instruction. table 2.4.4 a/d control register q3 notes 1: r represents read enabled, and w represents write enabled. 2: in order to select a in7 a in4 , set register q1 after setting regsiter q3. 2.4.2 a/d converter application examples (1) a/d conversion mode outline: analog input signal from a sensor can be converted into digital values. specifications: analog voltage values from a sensor is converted into digital values by using a 10- bit successive comparison method. use the a in0 pin for this analog input. figure 2.4.2 shows the a/d conversion mode setting example. a/d control register q2 at reset : 0000 2 p4 0 , p4 1 , p4 2 , p4 3 a in4 , a in5 , a in6 , a in7 p6 2 , p6 3 a in2 , a in3 p6 1 a in1 p6 0 a in0 p2 3 /a in3 pin function selection bit p6 2 /a in2 , p6 3 /a in3 pin function selection bit p6 1 /a in1 pin function selection bit p6 0 /a in0 pin function selection bit 0 1 0 1 0 1 0 1 q2 3 q2 2 q2 1 q2 0 a/d control register q3 at reset : 0000 2 this bit has no function, but read/write is enabled. instruction clock (instck) on-chip oscillator (f(ring)) not used a/d converter operation clock selection bit 0 1 0 1 q3 3 q3 2 at ram back-up : state retained r/w at ram back-up : state retained r/w q3 1 0 0 1 1 q3 0 0 1 0 1 division ratio frequency divided by 6 frequency divided by 12 frequency divided by 24 frequency divided by 48 a/d converter operation clock division ratio selection bits q3 1 q3 0
4519 group application 2.4 a/d converter 2-55 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.4.2 a/d conversion mode setting example ( ) ? disable interrupts a/d interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 ? 0 ?? b2: a/d interrupt occurrence disabled [ tv2a ] ? set a/d converter a/d conversion mode is selected to a/d operation mode. analog input pin a in0 is selected. instruction clock/6 is selected for a/d converter operation clock. b3 b0 a/d control register q2 ??? 1 b0: a in0 pin function selected [ tq2a ] b3 b0 a/d control register q1 0 0 0 0 b3: a/d conversion selected b2-b0: a in0 selected [ tq1a ] b3 b0 [ tq3a ] a/d control register q3 ? 0 0 0 b2: a/d converter operation clock: instruction clock b1, b0: frequency divided by 6 is selected for a/d converter operation clock ? clear interrupt request a/d interrupt activated condition is cleared. a/d conversion completion flag adf 0 a/d interrupt activated condition cleared [ snzad ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the flag adf, insert the nop instruction after the snzad instruction. ? start a/d conversion a/d conversion operation is started [ adst ] ? execute a/d conversion high-order 8 bits of register ad register a and register b [ tabad ] low-order 2 bits of register ad high-order 2 bits of register a [ tala ] 0 is set to low-order 2 bits of register a when a/d conversion is executed by the same channel, repeat ? to ? . when a/d conversion is executed by another channel, repeat ? to ? . ? : it can be 0 or 1. [ ] : instruction when interrupt is used ? set interrupt a/d interrupt temporarily disabled is enabled. b3 b0 interrupt control register v2 ? 1 ?? b2: a/d interrupt occurrence enabled [ tv2a ] interrupt enable flag inte 1 all interrupt enabled [ ei ] when interrupt is used ? a/d interrupt occurs when interrupt is not used ? set interrupt interrupts except a/d conversion is enabled. [ ei ] when interrupt is not used ? check a/d interrupt request a/d conversion completion flag is checked [ snzad ]
4519 group application 2.4 a/d converter 2-56 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.4.3 notes on use (1) note when the a/d conversion starts again when the a/d conversion starts again with the adst instruction during a/d conversion, the previous input data is invalidated and the a/d conversion starts again. (2) a/d converter-1 each analog input pin is equipped with a capacitor which is used to compare the analog voltage. accordingly, when the analog voltage is input from the circuit with high-impedance and, charge/ discharge noise is generated and the sufficient a/d accuracy may not be obtained. therefore, reduce the impedance or, connect a capacitor (0.01 f to 1 f) to analog input pins. figure 2.4.3 shows the analog input external circuit example-1. when the overvoltage applied to the a/d conversion circuit may occur, connect an external circuit in order to keep the voltage within the rated range as shown the figure 2.4.4. in addition, test the application products sufficiently. fig. 2.4.3 analog input external circuit example-1 (3) notes for the use of a/d conversion 2 do not change the operating mode of the a/d converter by bit 3 of register q1 during a/d conversion (a/d conversion mode and comparator mode). (4) notes for the use of a/d conversion 3 when the operating mode of the a/d converter is changed from the comparator mode to the a/d conversion mode with bit 3 of register q1 in a program, be careful about the following notes. clear bit 2 of register v2 to 0 to change the operating mode of the a/d converter from the comparator mode to the a/d conversion mode (refer to figure 2.4.5 ? ). the a/d conversion completion flag (adf) may be set when the operating mode of the a/d converter is changed from the comparator mode to the a/d conversion mode. accordingly, set a value to bit 3 of register q1, and execute the snzad instruction to clear the adf flag to 0 . fig. 2.4.4 analog input external circuit example-2 fig. 2.4.5 a/d converter operating mode program example clear bit 2 of register v2 to 0 ....... ? change of the operating mode of the a/d converter from the comparator mode to the a/d conversion mode clear the adf flag to 0 with the snzad instruction execute the nop instruction for the case when a skip is performed with the snzad instruction sensor a in a p p l y t h e v o l t a g e w i t h i i n t h e s p e c i f i c a t i o n s t o a n a n a l o g i n p u t p i n . s e n s o r a i n about 1k ?
4519 group application 2.4 a/d converter 2-57 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) a/d converter is used at the comparator mode the analog input voltage is higher than the comparison voltage as a result of comparison, the contents of adf flag retains 0, not set to 1. in this case, the a/d interrupt does not occur even when the usage of the a/d interrupt is enabled. accordingly, consider the time until the comparator operation is completed, and examine the state of adf flag by software. the comparator operation is completed after 2 machine cycles + a/d conversion clock (adck) 1 clock. (6) analog input pins when p4 0 /a in4 p4 3 /a in7 , p6 0 /a in0 p6 3 /a in3 are set to pins for analog input, they cannot be used as i/o ports p4 and p6. (7) tala instruction when the tala instruction is executed, the low-order 2 bits of register ad is transferred to the high- order 2 bits of register a, and simultaneously, the low-order 2 bits of register a is 0. (8) recommended operating conditions when using a/d converter as for the supply voltage when a/d converter is used and the recommended operating condition of the a/d convesion clock frequency, refer to the 3.1 electrical characteristics .
4519 group application 2.5 serial i/o 2-58 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.5 serial i/o the 4519 group has a clock-synchronous serial i/o which can be used to transmit and receive 8-bit data. this section describes serial i/o functions, related registers, application examples using serial i/o and notes. 2.5.1 serial i/o functions serial i/o consists of the serial i/o register si, serial i/o control register j1, serial i/o transmit/receive completion flag siof and serial i/o counter. a clock-synchronous serial i/o uses the shift clock generated by the clock control circuit as a synchronous clock. accordingly, the data transmit and receive operations are synchronized with this shift clock. in transmit operation, data is transmitted bit by bit from the s out pin synchronously with the falling edges of the shift clock. in receive operation, data is received bit by bit from the s in pin synchronously with the rising edges of the shift clock. note: 4519 group only supports lsb-first transmit and receive. shift clock when using the internal clock of 4519 group as a synchronous clock, eight shift clock pulses are output from the s ck pin when a transfer operation is started. also, when using some external clock as a synchronous clock, the clock that is input from the s ck pin is used as the shift clock. data transfer rate (baudrate) when using the internal clock, the data transfer rate can be determined by selecting the instruction clock divided by 2, 4 or 8. when using an external clock, the clock frequency input to the s ck pin determines the data transfer rate. figure 2.5.1 shows the serial i/o block diagram. fig. 2.5.1 serial i/o block diagram 1/8 1/4 1/2 00 01 10 11 synchronous circuit serial i/o counter (3) siof serial i/o interrupt instck p2 0 /s ck s ck qs r msb serial i/o register (8) lsb s in j1 1 j1 0 j1 3 j1 2 register b (4) register a (4) tsiab tabsi tabsi s out p2 1 /s out p2 2 /s in sst instruction internal reset signal
4519 group application 2.5 serial i/o 2-59 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.5.2 related registers (1) serial i/o register si serial i/o register si is the 8-bit data transfer serial/parallel conversion register. data can be set to register si through registers a and b with the tsiab instruction. also, the low-order 4 bits of register si is transferred to register a, and the high-order 4 bits of register si is transferred to register b with the tabsi instruction. (2) serial i/o transmit/receive completion flag (siof) serial i/o transmit/receive completion flag (siof) is set to 1 when serial data transmit or receive operation completes. the state of siof flag can be examined with the skip instruction ( snzsi ). (3) interrupt control register v2 table 2.5.1 shows the interrupt control register v2. set the contents of this register through register a with the tv2a instruction. in addition, the tav2 instruction can be used to transfer the contents of register v2 to register a. table 2.5.1 interrupt control register v2 notes 1: r represents read enabled, and w represents write enabled. 2: these instructions are equivalent to the nop instruction. 3: when setting the serial i/o, v2 2 , v2 1 and v2 0 are not used. (4) serial i/o mode register j1 table 2.5.2 shows the serial i/o mode register j1. set the contents of this register through register a with the tj1a instruction. in addition, the taj1 instruction can be used to transfer the contents of register j1 to register a. table 2.5.2 serial i/o mode register j1 interrupt control register v2 at reset : 0000 2 at ram back-up : 0000 2 r/w interrupt disabled ( snzsi instruction is valid) interrupt enabled ( snzsi instruction is invalid) ( note 2 ) interrupt disabled ( snzad instruction is valid) interrupt enabled ( snzad instruction is invalid) ( note 2 ) interrupt disabled ( snzt4 instruction is valid) interrupt enabled ( snzt4 instruction is invalid) ( note 2 ) interrupt disabled ( snzt3 instruction is valid) interrupt enabled ( snzt3 instruction is invalid) ( note 2 ) timer 4, serial i/o interrupt enable bit a/d interrupt enable bit timer 4 interrupt enable bit timer 3 interrupt enable bit v2 3 v2 2 v2 1 v2 0 0 1 0 1 0 1 0 1 serial i/o control register j1 at reset : 0000 2 synchronous clock instruction clock (instck) divided by 8 instruction clock (instck) divided by 4 instruction clock (instck) divided by 2 external clock (s ck input) port function p2 0 , p2 1 , p2 2 selected/s ck , s out , s in not selected s ck , s out , p2 2 selected/p2 0 , p2 1 , s in not selected s ck , p2 1 , s in selected/p2 0 , s out , p2 2 not selected s ck , s out , s in selected/p2 0 , p2 1 , p2 2 not selected serial i/o synchronous clock selection bits serial i/o port function selection bits j1 3 j1 2 note: r represents read enabled, and w represents write enabled. j1 3 0 0 1 1 j1 1 0 0 1 1 j1 2 0 1 0 1 j1 0 0 1 0 1 j1 1 j1 0 at ram back-up : state retained r/w
4519 group application 2.5 serial i/o 2-60 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.5.3 operation description figure 2.5.2 shows the serial i/o connection example, figure 2.5.3 shows the serial i/o register state, and figure 2.5.4 shows the serial i/o transfer timing. fig. 2.5.2 serial i/o connection example fig. 2.5.3 serial i/o register state when transfer s in pin s out pin s out pin s in pin serial i/o register (si) serial i/o register (si) transmit data set transfer start transfer complete master (m 7 m 0 : transmit data) slave (s 7 s 0 : transmit data) m 7 m 6 m 5 m 4 m 2 m 3 m 1 m 0 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 0 * s 0 m 0 s 0 m 0 falling of clock falling of clock rising of clock * * * m 7 m 6 m 5 m 4 m 2 m 3 m 1 m 0 m 7 m 6 m 5 m 4 m 2 m 3 m 1 m 7 m 6 m 5 m 4 m 2 m 3 m 1 m 7 m 6 m 5 m 4 m 2 m 3 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 0 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 7 s 6 s 5 s 4 s 3 s 2 s 7 s 6 s 5 s 4 s 3 s 2 s 1 s 0 s out s ck s in d 3 s ck s out s in d 3 4519 4519 master (internal clock selected) slave (external clock selected) control signal note: the control signal is used to inform the master by the pin level that the slave is in a ready state to receive. the 4524 group does not have a control pin exclusively used for serial i/o. accordingly, if a control signal is required, use the normal input/output ports.
4519 group application 2.5 serial i/o 2-61 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.5.4 serial i/o transfer timing m 0 m 7 : contents of master serial i/o register s 0 s 7 : contents of slave serial i/o register rising of s ck : serial input falling of s ck : serial output m 7 , s 7 : contents of previous master, slave msb s in s out master slave s ck sst instruction s out s in s 0 s 7 s 1 s 2 s 3 s 4 s 5 s 6 s 7 sst instruction control signal s 0 s 7 s 1 s 3 s 4 s 5 s 6 s 7 m 0 m 7 m 1 m 2 m 3 m 4 m 5 m 6 m 7 m 0 m 7 m 1 m 2 m 3 m 4 m 5 m 6 m 7 s 2
4519 group application 2.5 serial i/o 2-62 rev.1.00 aug 06, 2004 rej09b0175-0100z the full duplex communication of master and slave is described using the connection example shown in figure 2.5.2. (1) transmit/receive operation of master ? set the transmit data to the serial i/o register si with the tsiab instruction. when the tsiab instruction is executed, the contents of register a are transferred to the low-order 4 bits of register si and the contents of register b are transferred to the high-order 4 bits of register si. ? check whether the microcomputer on the slave side is ready to transmit/receive or not. in the connection example in figure 2.5.2, check that the input level of control signal is l level. ? start serial transmit/receive with the sst instruction. when the sst instruction is executed, the serial i/o transmit/receive completion flag (siof) is cleared to 0. ? the transmit data is output from the s out pin synchronously with the falling edges of the shift clock. ? the transmit data is output bit by bit beginning with the lsb of register si. each time one bit is output, the contents of register si is shifted one bit position toward the lsb. ? also, the receive data is input from the s in pin synchronously with the rising edges of the shift clock. ? the receive data is input bit by bit to the msb of register si. ? a serial i/o interrupt request occurs when the transmit/receive data is completed, and the siof flag is set to 1. ? the receive data is taken in within the serial i/o interrupt service routine; or the data is taken in after examining the completion of the transmit/receive operation with the snzsi instruction without using an interrupt. also, the siof flag is cleared to 0 when an interrupt occurs or the snzsi instruction is executed. notes 1: repeat steps ? through ? to transmit/receive multiple data in succession. 2: for the program on the master side, start to transmit the next data at the next timing (control signal turns l ). do not start to transmit the next data during the previous data transfer (control signal = l ).
4519 group application 2.5 serial i/o 2-63 rev.1.00 aug 06, 2004 rej09b0175-0100z (2) transmit/receive operation of slave ? set the transmit data into the serial i/o register si with the tsiab instruction. when the tsiab instruction is executed, the contents of register a are transferred to the low- order bits of register si and the contents of register b are transferred to the high-order bits of register si. at this time, the s ck pin must be at the h level. ? start serial transmit/receive with the sst instruction. however, in figure 2.5.2 where an external clock is selected, transmit/receive is not started until the clock is input. when the sst instruction is executed, the serial i/o transmit/receive completion flag (siof) is cleared to 0. ? the microcomputer on the master side is informed that the receiving side is ready to receive. in the connection example in figure 2.5.2, the control signal l level is output. ? the transmit data is output from the s out pin synchronously with the falling edges of the shift clock. ? the transmit data is output bit by bit beginning with the lsb of register si. each time one bit is output, the contents of register si are shifted to one bit position toward the lsb. ? also, the receive data is input from the s in pin synchronously with the rising edges of the shift clock. ? the receive data is input bit by bit to the msb of register si. ? a serial i/o interrupt request occurs when the transmit/receive is completed, and the siof flag is set to 1. ? read the receive data within the serial i/o interrupt service routine; or read the data after examining the completion of the transmit/receive operation with the snzsi instruction without using an interrupt. also, the siof flag is cleared to 0 when an interrupt occurs or the snzsi instruction is executed. ? set the control signal pin level to h after the receive operation is completed. note: repeat steps ? through ? to transmit/receive multiple data in succession. 2.5.4 serial i/o application example (1) serial i/o outline: the 4519 group can communicate with peripheral ics. specifications: figure 2.5.2 serial i/o connection example. figure 2.5.5 shows the setting example when a serial i/o interrupt of master side is not used, and figure 2.5.6 shows the slave serial i/o setting example.
4519 group application 2.5 serial i/o 2-64 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.5.5 setting example when a serial i/o of master side is not used ( ) ? disable interrupts ( note ) serial i/o interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 0 ??? b3: serial i/o interrupt occurrence disabled [ tv2a ] ? set port port for control signal is set to input. b3 b0 register y 0 0 1 1 specify bit position of port d [ tya ] port d 3 output latch 1 set to input [ sd ] b3 b0 [ tfr1a ] port output structure control register fr1 0 ??? b3: port d 3 n-channel open-drain output selected ? set serial i/o [ tj1a ] b3 b0 b3, b2: instruction clock divided by 4 is selected for serial i/o control regsiter ji 0 1 1 1 synchronous clock b1, b0: serial i/o ports s ck , s out , s in selected ? clear interrupt request serial i/o interrupt activated condition is cleared. serial i/o transmit/receive completion flag siof 0 serial i/o interrupt activated condition cleared [ snzsi ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the flag siof, insert the nop instruction after the snzsi instruction. ? set interrupts ( note ) interrupts except serial i/o interrupt is enabled. [ ei ] ? set transmit data transmit data is set to serial i/o register. serial i/o register si ?? 16 [ tsiab ] check start condition of serial i/o operation whether the transmit/receive of the slave side can be performed (pin level of control signal = l ) or not is checked. b3 b0 register y 0 0 1 1 specify bit position of port d [ tya ] port d 3 output latch 1 set to input [ sd ] port d 3 input level check [ szd ] ? start serial i/o operation if the transmit/receive of the slave side can be performed, serial transfer is started. [ sst ] ? check serial i/o interrupt request siof flag is checked. [ snzsi ] ? receive data processing data processing received by serial transfer is executed. register si register a, register b [ tabsi ] when serial communication is executed, repeat ? to ? . ? : it can be 0 or 1. [ ] : instruction
4519 group application 2.5 serial i/o 2-65 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.5.6 setting example when a serial i/o interrupt of slave side is used ( ) ? disable interrupts serial i/o interrupt is temporarily disabled. interrupt enable flag inte 0 all interrupts disabled [ di ] b3 b0 interrupt control register v2 0 ??? b3: serial i/o interrupt occurrence disabled [ tv2a ] ? set port port for control signal is set to h output. b3 b0 register y 0011 specify bit position of port d [ tya ] port d 3 output latch 1 set to h output [ sd ] b3 b0 port output structure control register fr1 1 ??? b3: port d 3 cmos output selected ? set serial i/o [ tj1a ] b3 b0 b3, b2: external clock is selected for synchronous clock serial i/o control regsiter ji 1111 b1, b0: serial i/o ports s ck , s out , s in selected ? clear interrupt request serial i/o interrupt activated condition is cleared. serial i/o transmit/receive completion flag siof 0 serial i/o interrupt activated condition cleared [ snzsi ] note when the interrupt request is cleared when ? is executed, considering the skip of the next instruction according to the flag siof, insert the nop instruction after the snzsi instruction. ? set interrupts the serial i/o interrupt which is temporarily disabled is enabled. b3 b0 interrupt control register v2 1 ??? b3: serial i/o interrupt occurrence enabled [ tv2a ] interrupt enable flag inte 1 all interrupts enabled [ ei ] ? set transmit data transmit data is set to serial i/o register. serial i/o register si ?? 16 [ tsiab ] set start of serial i/o operation serial i/o operation enabled state (serial transfer started, control signal l level output) is set. serial transfer start [ sst ] b3 b0 register y 0011 specify bit position of port d [ tya ] port d 3 output latch 0 set to l output [ rd ] : serial transmit/receive by clock of master side : ? receive data processing by serial i/o interrupt serial i/o operation disabled state (control signal h level output) is set and received data processing is performed.. b3 b0 register y 0011 specify bit position of port d [ tya ] port d 3 output latch 1 set to h output [ sd ] register si register a, register b [ tabsi ] when serial communication is executed, repeat ? to ? . ? : it can be 0 or 1. [ ] : instruction
4519 group application 2.5 serial i/o 2-66 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.5.5 notes on use (1) note when an external clock is used as a synchronous clock: an external clock is selected as the synchronous clock, the clock is not controlled internally. serial transmit/receive is continued as long as an external clock is input. if an external clock is input 9 times or more and serial transmit/receive is continued, the receive data is transferred directly as transmit data, so that be sure to control the clock externally. note also that the siof flag is set to 1 when a clock is counted 8 times. be sure to set the initial input level on the external clock pin to h level. refer to section 3.1 electrical characteristics when using serial i/o with an external clock.
4519 group application 2-67 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.6 reset system reset is performed by applying l level to the reset pin for 1 machine cycle or more when the following conditions are satisfied: the value of supply voltage is the minimum value or more of the recommended operating conditions. then when h level is applied to reset pin, the program starts from address 0 in page 0 after elapsing of the internal oscillation stabilizing time (on-chip oscillator (internal oscillator) clock is counted for 120 to 144 times). figure 2.6.2 shows the structure of reset pin and its peripherals, and power-on reset operation. 2.6.1 reset circuit the 4519 group has the voltage drop detection circuit. (1) power-on reset reset can be automatically performed at power on (power-on reset) by the built-in power-on reset circuit. when the built-in power-on reset circuit is used, the time for the supply voltage to rise from 0 v to the minimum rating value of the recommended operating conditions must be set to 100 s or less. if the rising time exceeds 100 s, connect a capacitor between the reset pin and v ss at the shortest distance, and input l level to reset pin until the value of supply voltage reaches the minimum rating value of the recommended operating conditions. fig. 2.6.1 structure of reset pin and its peripherals, and power-on reset operation fig. 2.6.2 oscillation stabilizing time after system is released from reset 2.6 reset reset pin wef watchdog reset signal (note 1) pull-up transistor (note 1) power-on reset circuit voltage drop detection circuit v dd (note 3) 100 s or less (note 2) internal reset signal power-on reset released internal reset signal reset state notes 1: this symbol represents a parasitic diode. 2: applied potential to reset pin must be v dd or less. 3: keep the value of supply voltage to the minimum value or more of the recommended operating conditions. power-on reset circuit output srst instruction reset 0.3v dd 0.85v dd ( note ) note: keep the value of supply voltage to the minimum value or more of the recommended operating conditions. reset input 1 machine cycle or more = program starts (address 0 in page 0) on-chip oscillator (internal oscillator) is counted 120 to 144 times.
4519 group application 2-68 rev.1.00 aug 06, 2004 rej09b0175-0100z program counter (pc) ................................................................................. address 0 in page 0 is set to program counter. interrupt enable flag (inte) ....................................................................... power down flag (p) ................................................................................... external 0 interrupt request flag (exf0) .................................................. external 1 interrupt request flag (exf1) .................................................. interrupt control register v1 ....................................................................... interrupt control register v2 ....................................................................... interrupt control register i1 ......................................................................... interrupt control register i2 ......................................................................... interrupt control register i3 ......................................................................... timer 1 interrupt request flag (t1f) ......................................................... timer 2 interrupt request flag (t2f) ......................................................... timer 3 interrupt request flag (t3f) ......................................................... timer 4 interrupt request flag (t4f) ......................................................... watchdog timer flags (wdf1, wdf2) ...................................................... watchdog timer enable flag (wef) ........................................................... timer control register pa ........................................................................... timer control register w1 ........................................................................... timer control register w2 ........................................................................... timer control register w3 ........................................................................... timer control register w4 ........................................................................... timer control register w5 ........................................................................... timer control register w6 ........................................................................... clock control register mr ........................................................................... serial i/o transmit/receive completion flag (siof) ................................. serial i/o mode register j1 ........................................................................ serial i/o register si ................................................................................... a/d conversion completion flag (adf) ..................................................... a/d control register q1 ............................................................................... a/d control register q2 ............................................................................... a/d control register q3 ............................................................................... successive comparison register ad .......................................................... comparator register ..................................................................................... 2.6.2 internal state at reset figure 2.6.3 and figure 2.6.4 show the internal state at reset. the contents of timers, registers, flags and ram other than shown in figure 2.6.3 and figure 2.6.4 are undefined, so that set them to initial values. fig. 2.6.3 internal state at reset ? represents undefined. 00000000000000 0 (interrupt disabled) 0 0 0 0000 (interrupt disabled) 0000 (interrupt disabled) 0000 0000 0 0 0 0 0 0 1 0 (prescaler stopped) 0000 (timer 1 stopped) 0000 (timer 2 stopped) 0000 (timer 3 stopped) 0000 (timer 4 stopped) 0000 0000 (period measurement circuit) 1111 0 0000 (external clock selected, serial i/o port not selected) ?????? 0 0000 0000 0000 ?????? ?????? ?? ???? ?? 2.6 reset
4519 group application 2-69 rev.1.00 aug 06, 2004 rej09b0175-0100z key-on wakeup control register k0 ........................................................... key-on wakeup control register k1 ........................................................... key-on wakeup control register k2 ........................................................... pull-up control register pu0 ....................................................................... pull-up control register pu1 ....................................................................... port output structure control register fr0 ............................................... port output structure control register fr1 ............................................... port output structure control register fr2 ............................................... port output structure control register fr3 ............................................... carry flag (cy) ............................................................................................. register a ..................................................................................................... register b ..................................................................................................... register d ..................................................................................................... register e ..................................................................................................... register x ..................................................................................................... register y ..................................................................................................... register z ..................................................................................................... stack pointer (sp) ....................................................................................... operation source clock ............................ on-chip oscillator (operating) ceramic resonator circuit ........................................................... operating quartz-crystal oscillation circuit ......................................................... stop rc oscillation circuit ............................................................................ stop ? ? fig. 2.6.4 internal state at reset ? represents undefined. 0000 0000 0000 0000 0000 0000 0000 0000 0000 0 0000 0000 ??? ?????? 0000 0000 ?? 111 2.6.3 notes on use (1) register initial value the initial value of the following registers are undefined after system is released from reset. after system is released from reset, set initial values. register z (2 bits) register d (3 bits) register e (8 bits) (2) power-on reset when the built-in power-on reset circuit is used, the time for the supply voltage to rise from 0 v to the minimum rating value of the recommended operating conditions must be set to 100 s or less. if the rising time exceeds 100 s, connect a capacitor between the reset pin and v ss at the shortest distance, and input l level to reset pin until the value of supply voltage reaches the minimum rating value of the recommended operating conditions. refer to section 3.1 electrical characteristics for the reset voltage of the recommended operating conditions. 2.6 reset
4519 group application 2-70 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.7 voltage drop detection circuit the built-in voltage drop detection circuit is designed to detect a drop in voltage and to reset the microcomputer if the supply voltage drops below a set value. figure 2.7.1 shows the voltage drop detection circuit, and figure 2.7.2 shows the operation waveform example of the voltage drop detection circuit. table 2.7.1 shows the voltage drop detection circuit operation state. refer to section 3.1 electrical characteristics for the reset voltage of the voltage drop detection circuit. fig. 2.7.1 voltage drop detection circuit fig. 2.7.2 voltage drop detection circuit operation waveform example table 2.7.1 voltage drop detection circuit operation state vdce pin l h at cpu operating invalid valid at ram back-up invalid valid v rst (reset release voltage) + - v dd voltage drop detection circuit reset signal microcomupter starts operation after on-chip oscillator (internal oscillator) clock is counted 120 to 144 times. v rst (reset voltage) reset pin note: detection voltage hysteresis of voltage drop detection circuit is 0.2 v (typ). 2.7 voltage drop detection circuit + v rst v rst + - vdce voltage drop detection circuit reset signal voltage drop detection circuit
4519 group application 2.8 ram back-up 2-71 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 2.8.1 state transition 2.8 ram back-up the 4519 group has the ram back-up mode. figure 2.8.1 shows the state transition. a operation state operation source clock: f(ring) f(x in ): stop key-on wakeup pof instruction execution e ram back-up mode d operation source clock: f(x in ) f(ring): stop pof instruction execution operation state notes 1: microcomputer starts its operation after counting f(ring) 120 to 144 times. c pof instruction execution operation state operation source clock: f(x in ) f(ring): operating b pof instruction execution operation state operation source clock: f(ring) f(x in ): operating f(ring): stop f(x in ): stop mr 1 1 mr 1 0 (note 5) (note 4) (note 4) (note 4) (note 4) mr 0 1 mr 0 0 rg 0 0 rg 0 1 reset (note 1) (note 2) (note 3) however, the selected contents (cmck, crck, cyck instruction execution state) of f(x in ) oscillation circuit is retained. 5: system returns to state a certainly when returning from the ram back-up mode. 4: continuous execution of the epof instruction and the pof instruction is required to go into the ram back-up state. 3: generate the wait time by software until the oscillation is stabilized, and then, switch the system clock. mr 1 cannot be cleared to 0 when the oscillation circuit is not selected. surely, select the f(x in ) oscillation circuit by executing the cmck, crck or cyck instruction before clearing mr 1 to 0 . the start/stop of oscillation and the operation source is switched by register mr. instruction (the start of oscillation and the operation source clock is not switched by these instructions). 2: the f(x in ) oscillation circuit (ceramic resonance, rc oscillation or quartz-crystal oscillation) is selected by the cmck, crck or cyck 2.8.1 ram back-up mode the system goes into ram back-up mode when the pof instruction is executed immediately after the epof instruction is executed. table 2.8.1 shows the function and state retained at ram back-up mode. also, table 2.8.2 shows the return source from this state. (1) ram back-up mode as oscillation stops with ram and the state of reset circuit retained, current dissipation can be reduced without losing the contents of ram.
4519 group application 2.8 ram back-up 2-72 rev.1.00 aug 06, 2004 rej09b0175-0100z notes 1: ??represents that the function can be retained, and ? ?represents that the function is initialized. registers and flags other than the above are undefined at ram back-up, and set an initial value after returning. 2: the stack pointer (sp) points the level of the stack register and is initialized to ??at ram back-up. 3: the state of the timer is undefined. 4: initialize the watchdog timer flag wdf1 with the wrst instruction, and then go into the ram back-up state. 5: the valid/invalid of the voltage drop detection circuit can be controlled only by vdce pin. table 2.8.1 functions and states retained at ram back-up mode function program counter (pc), registers a, b, carry flag (cy), stack pointer (sp) (note 2) contents of ram interrupt control registers v1, v2 interrupt control registers i1, i2 selected oscillation circuit clock control register mr timer 1 to timer 4 functions watchdog timer function timer control registers pa, w4 timer control registers w1 to w3, w5, w6 serial i/o function serial i/o control register j1 a/d function a/d control registers q1 to q3 voltage drop detection circuit port level pull-up control registers pu0, pu1 key-on wakeup control registers k0 to k2 port output format control registers fr0 to fr3 external interrupt request flags (exf0, exf1) timer interrupt request flags (t1f to t4f) a/d conversion completion flag (adf) serial i/o transmit/receive completion flag siof interrupt enable flag (inte) watchdog timer flags (wdf1, wdf2) watchdog timer enable flag (wef) ? o ? o o o ( note 3 ) ? ( note 4 ) ? o ? o ? o o ( note 5 ) o o o o ? ( note 3 ) ? ? ? ? ( note 4 ) ? ( note 4 ) ram back-up
4519 group application 2.8 ram back-up 2-73 rev.1.00 aug 06, 2004 rej09b0175-0100z table 2.8.2 return source and return condition remarks the key-on wakeup function can be selected with 2 port units. select the return level ( l level or h level), and return condition (return by level or edge) with the register k1 according to the external state before going into the ram back-up state. the key-on wakeup function can be selected with 2 port units. set the port using the key-on wakeup function to h level before going into the ram back-up state. select the return level ( l level or h level) with the registers i1 and i2 according to the external state, and return condition (return by level or edge) with the register k2 before going into the ram back-up state. return condition return by an external h level or l level input, or rising edge ( l h ) or falling edge ( h l ). return by an external l level input. return by an external h level or l level input, or rising edge ( l h ) or falling edge ( h l ). the external interrupt request flags (exf0, exf1) are not set. external wakeup signal return source ports p0 0 p0 3 ports p1 0 p1 3 int0 int1 (3) start condition identification when system returns from both ram back-up mode and reset, program is started from address 0 in page 0. the start condition (warm start or cold start) can be identified by examining the state of the power down flag (p) with the snzp instruction. table 2.8.3 shows the start condition identification, and figure 2.8.4 shows the start condition identified example. table 2.8.3 start condition identification fig. 2.8.2 start condition identified example start condition warm start external wakeup signal input cold start reset pulse input to reset pin (reset) reset by watchdog timer reset by voltage drop detection circuit srst instruction execution p flag 1 0 timer 5 interrupt request flag 0 0 program start p = 1 ? yes warm start cold start no
4519 group application 2.8 ram back-up 2-74 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.8.2 related registers (1) interrupt control register i1 table 2.8.4 shows the interrupt control register i1. set the contents of this register through register a with the ti1a instruction. in addition, the tai1 instruction can be used to transfer the contents of register i1 to register a. table 2.8.4 interrupt control register i1 interrupt control register i1 at reset : 0000 2 at ram back-up : state retained int0 pin input disabled int0 pin input enabled falling waveform/ l level ( l level is recognized with the snzi0 instruction) rising waveform/ h level ( h level is recognized with the snzi0 instruction) one-sided edge detected both edges detected timer 1 count start synchronous circuit not selected timer 1 count start synchronous circuit selected int0 pin input control bit ( note 2 ) interrupt valid waveform for int0 pin/return level selection bit ( note 2 ) int0 pin edge detection circuit control bit int0 pin timer 1 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i1 3 i1 2 i1 1 i1 0 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i1 2 and i1 3 are changed, the external interrupt request flag exf0 may be set to 1 . accordingly, clear exf0 flag with the snz0 instruction when the bit 0 (v1 0 ) of register v1 to 0 . in this time, set the nop instruction after the snz0 instruction, for the case when a skip is performed with the snz0 instruction. 3: when setting the ram back-up, i1 1 i1 0 are not used. (2) interrupt control register i2 table 2.8.5 shows the interrupt control register i2. set the contents of this register through register a with the ti2a instruction. in addition, the tai2 instruction can be used to transfer the contents of register i2 to register a. table 2.8.5 interrupt control register i2 r/w interrupt control register i2 at reset : 0000 2 at ram back-up : state retained int1 pin input disabled int1 pin input enabled falling waveform/ l level ( l level is recognized with the snzi1 instruction) rising waveform/ h level ( h level is recognized with the snzi1 instruction) one-sided edge detected both edges detected timer 3 count start synchronous circuit not selected timer 3 count start synchronous circuit selected int1 pin input control bit ( note 2 ) interrupt valid waveform for int1 pin/return level selection bit ( note 2 ) int1 pin edge detection circuit control bit int1 pin timer 3 count start synchronous circuit selection bit 0 1 0 1 0 1 0 1 i2 3 i2 2 i2 1 i2 0 notes 1: r represents read enabled, and w represents write enabled. 2: when the contents of i2 2 and i2 3 are changed, the external interrupt request flag exf1 may be set to 1 . accordingly, clear exf1 flag with the snz1 instruction when the bit 1 (v1 1 ) of register v1 to 0 . in this time, set the nop instruction after the snz1 instruction, for the case when a skip is performed with the snz1 instruction. 3: when setting the ram back-up, i2 1 i2 0 are not used. r/w
4519 group application 2.8 ram back-up 2-75 rev.1.00 aug 06, 2004 rej09b0175-0100z note: r represents read enabled, and w represents write enabled. pull-up control register pu0 at reset : 0000 2 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p0 3 pin pull-up transistor control bit p0 2 pin pull-up transistor control bit p0 1 pin pull-up transistor control bit p0 0 pin pull-up transistor control bit 0 1 0 1 0 1 0 1 pu0 3 pu0 2 pu0 1 pu0 0 (3) pull-up control register pu0 table 2.8.6 shows the pull-up control register pu0. set the contents of this register through register a with the tpu0a instruction. the contents of register pu0 is transferred to register a with the tapu0 instruction. table 2.8.6 pull-up control register pu0 at ram back-up : state retained r/w
4519 group application 2.8 ram back-up 2-76 rev.1.00 aug 06, 2004 rej09b0175-0100z (4) pull-up control register pu1 table 2.8.7 shows the pull-up control register pu1. set the contents of this register through register a with the tpu1a instruction. the contents of register pu1 is transferred to register a with the tapu1 instruction. table 2.8.7 pull-up control register pu1 pull-up control register pu1 at reset : 0000 2 pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on pull-up transistor off pull-up transistor on p1 3 pin pull-up transistor control bit p1 2 pin pull-up transistor control bit p1 1 pin pull-up transistor control bit p1 0 pin pull-up transistor control bit 0 1 0 1 0 1 0 1 pu1 3 pu1 2 pu1 1 pu1 0 at ram back-up : state retained r/w note: r represents read enabled, and w represents write enabled. (5) key-on wakeup control register k0 table 2.8.8 shows the key-on wakeup control register k0. set the contents of this register through register a with the tk0a instruction. the contents of register k0 is transferred to register a with the tak0 instruction. table 2.8.8 key-on wakeup control register k0 key-on wakeup control register k0 at reset : 0000 2 key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used key-on wakeup not used key-on wakeup used pins p1 2 and p1 3 key-on wakeup control bit pins p1 0 and p1 1 key-on wakeup control bit pins p0 2 and p0 3 key-on wakeup control bit pins p0 0 and p0 1 key-on wakeup control bit 0 1 0 1 0 1 0 1 k0 3 k0 2 k0 1 k0 0 note: r represents read enabled, and w represents write enabled. at ram back-up : state retained r/w
4519 group application 2.8 ram back-up 2-77 rev.1.00 aug 06, 2004 rej09b0175-0100z (6) key-on wakeup control register k1 table 2.8.9 shows the key-on wakeup control register k1. set the contents of this register through register a with the tk1a instruction. the contents of register k1 is transferred to register a with the tak1 instruction. table 2.8.9 key-on wakeup control register k1 key-on wakeup control register k1 at reset : 0000 2 return by level return by edge falling waveform/ l level rising waveform/ h level return by level return by edge falling waveform/ l level rising waveform/ h level ports p0 2 and p0 3 return condition selection bit ports p0 2 and p0 3 valid waveform/level selection bit ports p0 1 and p0 0 return condition selection bit ports p0 1 and p0 0 valid waveform/level selection bit 0 1 0 1 0 1 0 1 k1 3 k1 2 k1 1 k1 0 note: r represents read enabled, and w represents write enabled. (7) key-on wakeup control register k2 table 2.8.10 shows the key-on wakeup control register k2. set the contents of this register through register a with the tk2a instruction. the contents of register k2 is transferred to register a with the tak2 instruction. table 2.8.10 key-on wakeup control register k2 at ram back-up : state retained r/w key-on wakeup control register k2 at reset : 0000 2 return by level return by edge key-on wakeup not used key-on wakeup used returned by level returned by edge key-on wakeup not used key-on wakeup used int1 pin return condition selection bit int1 pin key-on wakeup control bit int0 pin return condition selection bit int0 pin key-on wakeup control bit 0 1 0 1 0 1 0 1 k2 3 k2 2 k2 1 k2 0 note: r represents read enabled, and w represents write enabled. at ram back-up : state retained r/w
4519 group application 2.8 ram back-up 2-78 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.8.3 notes on use (1) pof instruction execute the pof instruction immediately after executing the epof instruction to enter the ram back-up state. note that system cannot enter the ram back-up state when executing only the pof instruction. be sure to disable interrupts by executing the di instruction before executing the epof instruction and the pof instruction. (2) key-on wakeup function after checking none of the return condition for ports (p0, p1, int0 and int1 specified with register k0 k2) with valid key-on wakeup function is satisfied, execute the pof instruction. if at least one of return condition for ports with valid key-on wakeup function is satisfied, system returns from the ram back-upn state immediately after the pof instruction is executed. (3) return from ram back-up mode after system returns from ram back-up mode, set the undefined registers and flags. the initial value of the following registers are undefined at ram back-up. after system is returned from ram back-up mode, set initial values. register z (2 bits) register x (4 bits) register y (4 bits) register d (3 bits) register e (8 bits) (4) watchdog timer the watchdog timer function is valid after system is returned from the ram back-up state. when not using the watchdog timer function, stop the watchdog timer function with the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up. when the watchdog timer function and ram back-up function are used at the same time, initialize the flag wdf1 with the wrst instruction before system goes into the ram back-up state. (5) port p3 0 /int0 pin when the ram back-up mode is used by clearing the bit 3 of register i1 to 0 and setting the input of int0 pin to be disabled, be careful about the following note. when the input of int0 pin is disabled (register i1 3 = 0 ), clear bit 0 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode. (6) port p3 1 /int1 pin when the ram back-up mode is used by clearing the bit 3 of register i2 to 0 and setting the input of int1 pin to be disabled, be careful about the following note. when the input of int1 pin is disabled (register i2 3 = 0 ), clear bit 2 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode.
4519 group application 2.9 oscillation circuit 2-79 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.9 oscillation circuit the 4519 group has an internal oscillation circuit to produce the clock required for microcomputer operation. the 4519 group operates by the on-chip oscillator clock (f(ring)) which is the internal oscillator after system is released from reset. also, the ceramic resonator, the rc oscillation or quartz-crystal oscillator can be used for the main clock (f(x in )) of the 4519 group. the cmck instruction, crck instruction or cyck instruction is executed to select the ceramic resonator, rc oscillator or quartz-crystal oscillator respectively. 2.9.1 oscillation operation system clock is supplied to cpu and peripheral device as the base clock for the microcomputer operation. the system clock f(x in ) or f(ring) is selected by bit 0 of register mr. the oscillation start/stop of main clock f(x in ) is controlled by bit 1 of register mr. also, an operation mode of a selected clock is selected from the followings by bits 3 and 2 of register mr. through mode (f(x in )) (not divided), frequency divided by 2 mode (f(x in )/2), frequency divided by 4 mode (f(x in )/4), or frequency divided by 8 mode (f(x in )/8) figure 2.9.1 shows the structure of the clock control circuit. fig. 2.9.1 structure of clock control circuit mr 3, mr 2 00 01 10 11 cmck instruction qs r internal reset signal key-on wakeup signal epof instruction pof instruction + qs r 0 mr 0 1 division circuit system clock (stck) instruction clock (instck) multi- plexer quartz-crystal oscillation on-chip oscillator (internal oscillator) x out x in ceramic resonance rc oscillation internal clock generating circuit (divided by 3) rg 0 mr 1 qs r qs r q s r crck instruction cyck instruction divided by 2 divided by 4 divided by 8
4519 group application 2.9 oscillation circuit 2-80 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.9.2 related register (1) clock control register mr table 2.9.1 shows the clock control register mr. set the contents of this register through register a with the tmra instruction. the contents of register mr is transferred to register a with the tamr instruction. table 2.9.1 clock control register mr clock control register mr at reset : 1111 2 main clock oscillation enabled main clock oscillation stop main clock (f(x in ) sub-clock (f(x cin )) operation mode selection bits main clock f(x in ) oscillation circuit control bit system clock oscillation source selection bit 0 1 0 1 mr 1 mr 0 note: r represents read enabled, and w represents write enabled. at ram back-up : state retained r/w operation mode through-mode (frequency not divided) frequency divided by 2 mode frequency divided by 4 mode frequency divided by 8 mode mr 3 0 0 1 1 mr 2 0 1 0 1 mr 3 mr 2 (2) clock control register rg table 2.9.2 shows the clock control register rg. set the contents of this register through register a with the trga instruction. table 2.9.2 clock control register rg clock control register rg at reset : 0 2 on-chip oscillator (f(ring)) oscillation enabled on-chip oscillator (f(ring)) oscillation stop on-chip oscillator (f(ring)) control bit 0 1 rg 0 at ram back-up : state retained w
4519 group application 2.9 oscillation circuit 2-81 rev.1.00 aug 06, 2004 rej09b0175-0100z 2.9.3 notes on use (1) clock control execute the main clock (f(x in )) selection instruction ( cmck , crck or cyck instruction) in the initial setting routine of program (executing it in address 0 in page 0 is recommended). the oscillation circuit by the cmck , crck or cyck instruction can be selected only at once. the oscillation circuit corresponding to the first executed one of these instructions is valid. the cmck , crck or cyck instructions can be used only to select main clock (f(x in )). in this time, the start of oscillation and the switch of system clock are not performed. when the cmck , crck or cyck instructions are never executed, main clock (f(x in )) cannot be used and system can be operated only by on-chip oscillator. the no operated clock source (f(ring)) or (f(x in )) cannot be used for the system clock. also, the clock source (f(ring) or f(x in )) selected for the system clock cannot be stopped. (2) on-chip oscillator the clock frequency of the on-chip oscillator depends on the supply voltage and the operation temperature range. be careful that margin of frequencies when designing application products. when considering the oscillation stabilize wait time at the switch of clock, be careful that the margin of frequencies of the on-chip oscillator clock. (3) external clock when the external clock signal for the main clock (f(x in )) is used, connect the clock source to x in pin and x out pin open. in program, after the cmck instruction is executed, set main clock (f(x in )) oscillation start to be enabled (mr 1 =0). for this product, when ram back-up mode and main clock (f(x in )) stop (mr 1 =1), x in pin is fixed to h in order to avoid the through current by floating of internal logic. the x in pin is fixed to h until main clock (f(x in )) oscillation start to be valid (mr 1 =0) by the cmck instruction from reset state. accordingly, when an external clock is used, connect a 1 k ? or more resistor to x in pin in series to limit of current by competitive signal. (4) value of a part connected to an oscillator values of a capacitor and a resistor of the oscillation circuit depend on the connected oscillator and the board. accordingly, consult the oscillator manufacturer for values of each part connected the oscillator.
chapter 3 appendix 3.1 electrical characteristics 3.2 typical characteristics 3.3 list of precautions 3.4 notes on noise 3.5 package outline
4519 group appendix 3.1 electrical characteristics 3-2 rev.1.00 aug 06, 2004 rej09b0175-0100z parameter supply voltage input voltage p0, p1, p2, p3, p4, p5, p6, d 0 ? 7 , reset, x in , vdce input voltage s ck , s in , cntr0, cntr1, int0, int1 input voltage a in0 ? in7 output voltage p0, p1, p2, p3, p4, p5, p6, d 0 ? 7 , reset output voltage s ck , s out , cntr0, cntr1 output voltage x out power dissipation operating temperature range storage temperature range conditions output transistors in cut-off state output transistors in cut-off state ta = 25 ? 42p2r-a symbol v dd v i v i v i v o v o v o p d topr tstg unit v v v v v v v mw ? ? ratings ?.3 to 6.5 ?.3 to v dd +0.3 ?.3 to v dd +0.3 ?.3 to v dd +0.3 ?.3 to v dd +0.3 ?.3 to v dd +0.3 ?.3 to v dd +0.3 300 ?0 to 85 ?0 to 125 3.1 electrical characteristics 3.1.1 absolute maximum ratings table 3.1.1 absolute maximum ratings
4519 group appendix 3.1 electrical characteristics 3-3 rev.1.00 aug 06, 2004 rej09b0175-0100z symbol v dd v dd v dd v ram v ss v ih v ih v ih v il v il v il i oh (peak) i oh (avg) i ol (peak) i ol (peak) i ol (peak) i ol (peak) i ol (avg) i ol (avg) i ol (avg) i ol (avg) i oh (avg) i ol (avg) parameter supply voltage (when ceramic resonator/on-chip oscillator is used) supply voltage (when rc oscillation is used) supply voltage (when quartz-crystal oscillator is used) ram back-up voltage supply voltage ??level input voltage ??level input voltage ??level input voltage ??level input voltage ??level input voltage ??level input voltage ??level peak output current ??level average output current (note) ??level peak output current ??level peak output current ??level peak output current ??level peak output current ??level average output current (note) ??level average output current (note) ??level average output current (note) ??level average output current (note) ??level total average current ??level total average current note: the average output current is the average value during 100 ms. unit conditions mask rom version one time prom version f(stck) 4.4 mhz mask rom version one time prom version mask rom version one time prom version p0, p1, p2, p3, p4, p5, p6, d 0 ? 7 , vdce, x in reset s ck , s in , cntr0, cntr1, int0, int1 p0, p1, p2, p3, p4, p5, p6, d 0 ? 7 , vdce, x in reset s ck , s in , cntr0, cntr1, int0, int1 p0, p1, p5, d 0 ? 7 cntr0, cntr1 p0, p1, p5, d 0 ? 7 cntr0, cntr1 p0, p1, p2, p4, p5, p6 s ck , s out p3, reset d 0 ? 5 d 6 , d 7 cntr0, cntr1 p0, p1, p2, p4, p5, p6 s ck , s out p3, reset d 0 ? 5 d 6 , d 7 cntr0, cntr1 p5, d 0 ? 7 , cntr0, cntr1 p0, p1 p2, p5, d 0 ? 7 , reset , cntr0, cntr1 p0, p1, p3, p4, p6 max. 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 v dd v dd v dd 0.2v dd 0.3v dd 0.15v dd ?0 ?0 ?0 ? 24 12 10 4 24 12 40 30 12 6 5 2 15 7 30 15 ?0 ?0 80 80 limits min. 4.0 2.7 2.0 1.8 4.0 2.7 2.5 2.7 2.0 2.5 1.6 2.0 0.8v dd 0.85v dd 0.85v dd 0 0 0 typ. 0 f(stck) 6 mhz f(stck) 4.4 mhz f(stck) 2.2 mhz f(stck) 1.1 mhz f(stck) 6 mhz f(stck) 4.4 mhz f(stck) 2.2 mhz f(x in ) 50 khz f(x in ) 50 khz at ram back-up mode at ram back-up mode v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v v v v v v v v v v v v v ma ma ma ma ma ma ma ma ma ma ma ma 3.1.2 recommended operating conditions table 3.1.2 recommended operating conditions 1 (mask rom version: ta = ?0 ? to 85 ?, v dd = 1.8 to 5.5 v, unless otherwise noted) (one time prom version: ta = ?0 ? to 85 ?, v dd = 2.5 to 5.5 v, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-4 rev.1.00 aug 06, 2004 rej09b0175-0100z f(x in ) f(x in ) f(x in ) oscillation frequency (with a ceramic resonator) oscillation frequency (at rc oscillation) (note) oscillation frequency (with a ceramic resonator selected, external clock input) conditions mhz mhz mhz max. 6.0 4.4 2.2 1.1 6.0 4.4 2.2 6.0 4.4 6.0 4.4 2.2 6.0 4.4 6.0 4.4 4.8 3.2 1.6 0.8 4.8 3.2 1.6 4.8 3.2 4.8 3.2 1.6 4.8 3.2 4.8 limits mask rom version one time prom version v dd = 2.7 to 5.5 v mask rom version one time prom version min. typ. parameter symbol unit note: the frequency is affected by a capacitor, a resistor and a microcomputer. so, set the constants within the range of the f requency limits. v dd = 4.0 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 4.0 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.5 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.5 to 5.5 v v dd = 2.5 to 5.5 v v dd = 4.0 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 2.0 to 5.5 v v dd = 1.8 to 5.5 v v dd = 4.0 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.5 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.5 to 5.5 v v dd = 2.5 to 5.5 v through mode frequency/2 mode frequency/4, 8 mode through mode frequency/2 mode frequency/4, 8 mode through mode frequency/2 mode frequency/4, 8 mode through mode frequency/2 mode frequency/4, 8 mode 6 4.4 2 (2.5) 2.7 4 1.8 5.5 v dd [v] 2.2 1.1 f(stck) [mhz] 3.2 4.8 2 (2.5) 2.7 4 1.8 5.5 v dd 1.6 0.8 when external clock is used when rc oscillation is used when ceramic resonance is used f(stck) [mhz] 4.4 2.7 5.5 v dd [v] f(stck) [mhz] ( ): one time prom version recommended operating operation recommended operating operation recommended operating operation table 3.1.3 recommended operating conditions 2 (mask rom version: ta = 20 c to 85 c, v dd = 1.8 to 5.5 v, unless otherwise noted) (one time prom version: ta = 20 c to 85 c, v dd = 2.5 to 5.5 v, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-5 rev.1.00 aug 06, 2004 rej09b0175-0100z conditions limits parameter symbol unit mask rom version v dd = 2.0 to 5.5 v one time prom version v dd = 2.5 to 5.5 v cntr0, cntr1 cntr0, cntr1 s ck s ck mask rom version v dd = 0 1.8 v one time prom version v dd = 0 2.5 v oscillation frequency (with a quartz-crystal oscillator) timer external input frequency timer external input period ( h and l pulse width) serial i/o external input frequency serial i/o external input frequency ( h and l pulse width) power-on reset circuit valid supply voltage rising time f(x in ) f(cntr) tw(cntr) f(s ck ) tw(s ck ) tpon khz hz s hz s s 50 50 f(stck)/6 f(stck)/6 100 100 3/f(stck) 3/f(stck) typ. max. min. table 3.1.4 recommended operating conditions 3 (mask rom version: ta = 20 c to 85 c, v dd = 1.8 to 5.5 v, unless otherwise noted) (one time prom version: ta = 20 c to 85 c, v dd = 2.5 to 5.5 v, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-6 rev.1.00 aug 06, 2004 rej09b0175-0100z v oh v ol v ol v ol v ol i ih i il r pu v t+ v t v t+ v t f(ring) ? f(x in ) h level output voltage p0, p1, p5, d 0 d 7 , cntr0, cntr1 l level output voltage p0, p1, p2, p4, p5, p6 s ck , s out l level output voltage p3, reset l level output voltage d 0 d 5 l level output voltage d 6 , d 7 , cntr0, cntr1 h level input current p0, p1, p2, p3, p4, p5, p6, d 0 d 7 , vdce, reset, s ck , s in , cntr0, cntr1, int0, int1 l level input current p0, p1, p2, p3, p4, p5, p6, d 0 d 7 , vdce, s ck , s in , cntr0, cntr1, int0, int1 pull-up resistor value p0, p1, reset hysteresis s ck , s in , cntr0, cntr1, int0, int1 hysteresis reset on-chip oscillator clock frequency frequency error (with rc oscillation, error of external r, c not included ) (note) v v v v v a a k ? v v khz % % test conditions v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v i = v dd ports p4, p6 selected v i = 0 v p0, p1 no pull-up ports p4, p6 selected v i = 0 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v v dd = 5 v v dd = 3 v mask rom version v dd = 1.8 v v dd = 5 v 10 %, ta = 25 c v dd = 3 v 10 %, ta = 25 c limits max. 2 0.9 0.9 0.6 2 0.9 0.9 2 0.9 1.4 0.9 2 0.9 2 0.9 2 2 125 250 700 400 200 17 17 i oh = 10 ma i oh = 3 ma i oh = 5 ma i oh = 1 ma i ol = 12 ma i ol = 4 ma i ol = 6 ma i ol = 2 ma i ol = 5 ma i ol = 1 ma i ol = 2 ma i ol = 15 ma i ol = 5 ma i ol = 9 ma i ol = 3 ma i ol = 30 ma i ol = 10 ma i ol = 15 ma i ol = 5 ma v dd = 5 v v dd = 3 v min. 3 4.1 2.1 2.4 30 50 200 100 30 typ. symbol parameter unit 60 120 0.2 0.2 1 0.4 500 250 120 note: when rc oscillation is used, use the external 30 pf or 33 pf capacitor (c). 3.1.3 electrical characteristics table 3.1.5 electrical characteristics 1 (mask rom version: ta = 20 c to 85 c, v dd = 1.8 to 5.5 v, unless otherwise noted) (one time prom version: ta = 20 c to 85 c, v dd = 2.5 to 5.5 v, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-7 rev.1.00 aug 06, 2004 rej09b0175-0100z i dd supply current at active mode (with a ceramic resonator, on-chip oscillator stop) at active mode (with a quartz-crystal oscillator, on-chip oscillator stop) at active mode (with an on-chip oscillator, f(x in ) stop) at ram back-up mode (pof instruction execution) ma ma ma a a a a a test conditions v dd = 5 v f(x in ) = 6 mhz v dd = 5 v f(x in ) = 4 mhz v dd = 3 v f(x in ) = 4 mhz v dd = 5 v f(x in ) = 32 khz v dd = 3 v f(x in ) = 32 khz v dd = 5 v v dd = 3 v ta = 25 ? v dd = 5 v v dd = 3 v limits max. 2.8 3.2 4.0 5.6 2.2 2.4 3.0 4.0 0.8 1.0 1.2 1.6 110 120 130 140 24 26 28 30 100 140 200 300 20 30 40 70 3 10 6 min. typ. 1.4 1.6 2.0 2.8 1.1 1.2 1.5 2.0 0.4 0.5 0.6 0.8 55 60 65 70 12 13 14 15 50 70 100 150 10 15 20 35 0.1 symbol parameter unit f(stck) = f(x in )/8 f(stck) = f(x in )/4 f(stck) = f(x in )/2 f(stck) = f(x in ) f(stck) = f(x in )/8 f(stck) = f(x in )/4 f(stck) = f(x in )/2 f(stck) = f(x in ) f(stck) = f(x in )/8 f(stck) = f(x in )/4 f(stck) = f(x in )/2 f(stck) = f(x in ) f(stck) = f(x in )/8 f(stck) = f(x in )/4 f(stck) = f(x in )/2 f(stck) = f(x in ) f(stck) = f(x in )/8 f(stck) = f(x in )/4 f(stck) = f(x in )/2 f(stck) = f(x in ) f(stck) = f(ring)/8 f(stck) = f(ring)/4 f(stck) = f(ring)/2 f(stck) = f(ring) f(stck) = f(ring)/8 f(stck) = f(ring)/4 f(stck) = f(ring)/2 f(stck) = f(ring) table 3.1.6 electrical characteristics 2 (mask rom version: ta = ?0 ? to 85 ?, v dd = 1.8 to 5.5 v, unless otherwise noted) (one time prom version: ta = ?0 ? to 85 ?, v dd = 2.5 to 5.5 v, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-8 rev.1.00 aug 06, 2004 rej09b0175-0100z symbol v dd v ia f(adck) parameter supply voltage analog input voltage a/d conversion clock frequency (note) conditions unit v v khz mask rom version one time prom version mask rom version one time prom version min. 2.0 3.0 0 0.8 0.8 0.8 0.8 0.8 0.8 typ. max. 5.5 5.5 v dd 334 245 3.9 1.8 334 123 limits v dd = 4.0 to 5.5 v v dd = 2.7 to 5.5 v v dd = 2.2 to 5.5 v v dd = 2.0 to 5.5 v v dd = 4.0 to 5.5 v v dd = 3.0 to 5.5 v note: definition of a/d conversion clock (adck) 334 245 (123) 2.2 ( ): one time prom version 2.7 (3.0) 4 2 5.5 v dd [v] 3.9 (15.3) 1.8 0.8 f(adck) [khz] recommended operating operation 11 10 01 00 0 1 instruction clock (instck) on-chip oscillator clock(ring) a/d conversion clock (adck) division circuit system clock (stck) instruction clock (instck) multi- plexer (cmck, crck, cyck) mr 0 1 0 mr 3 , mr 2 01 00 10 11 on-chip oscillator x in ceramic resonance rc oscillation internal clock generating circuit (divided by 3) quartz-crystal oscillation on-chip oscillator clock (ring) q3 1 , q3 0 q3 2 divided by 2 divided by 4 divided by 8 division circuit divided by 12 divided by 24 divided by 48 divided by 6 3.1.4 a/d converter recommended operating conditions table 3.1.7 a/d converter recommended operating conditions (comparator mode included, ta = ?0 ? to 85 ?, unless otherwise noted)
4519 group appendix 3.1 electrical characteristics 3-9 rev.1.00 aug 06, 2004 rej09b0175-0100z table 3.1.8 a/d converter characteristics (ta = ?0 ? to 85 ?, unless otherwise noted) symbol v 0t v fst ia dd t conv parameter resolution linearity error differential non-linearity error zero transition voltage full-scale transition voltage absolute accuracy (quantization error excluded) a/d operating current (note 1) a/d conversion time comparator resolution comparator error (note 2) comparator comparison time test conditions unit 2.7 (3.0) v v dd 5.5 v((): one time prom version) mask rom version 2.2 v v dd < 2.7 v 2.2 (3.0) v v dd 5.5 v ((): one time prom version) mask rom version one time prom version mask rom version one time prom version mask rom version v dd = 5 v v dd = 3 v f(x in ) = 6 mhz f(stck) = f(x in ) (x in through mode) adck=instck/6 mask rom version one time prom version f(x in ) = 6 mhz f(stck) = f(x in ) (x in through mode) adck=instck/6 min. 0 0 0 0 3 5105 3064.5 2552.5 5100 3065 typ. 10 7.5 7.5 15 13 5115 3072 2560 5115 3075 150 75 max. 10 ? ? ?.9 20 15 15 30 23 5125 3079.5 2567.5 5130 3085 ? 450 225 31 8 ?0 ?5 ?5 ?0 ?3 4 limits notes 1: when the a/d converter is used, ia dd is added to i dd (supply current). 2: as for the error from the ideal value in the comparator mode, when the contents of the comparator register is n, the logic v alue of the comparison voltage v ref which is generated by the built-in d/a converter can be obtained by the following formula. logic value of comparison voltage v ref v ref = ? n n = value of register ad (n = 0 to 255) v dd 256 bits lsb lsb mv mv lsb a s bits mv s v dd = 5.12 v v dd = 3.072 v v dd = 2.56 v v dd = 5.12 v v dd = 3.072 v v dd = 5.12 v v dd = 3.072 v v dd = 2.56 v v dd = 5.12 v v dd = 3.072 v 2.0 v v dd < 2.2 v v dd = 5.12 v v dd = 3.072 v v dd = 2.56 v v dd = 5.12 v v dd = 3.072 v
4519 group appendix 3.1 electrical characteristics 3-10 rev.1.00 aug 06, 2004 rej09b0175-0100z test conditions ta = 25 ? ta = 25 ? v dd = 5 v v dd = 3 v v dd (vrst ? ?0.1 v) (note 4) parameter detection voltage (reset occurs) (note 1) detection voltage (reset release) (note 2) detection voltage hysteresis operation current (note 3) detection time symbol v rst v rst+ v rst+ v rst i rst t rst limits unit min. 3.3 2.7 2.6 3.5 2.9 2.8 typ. 3.5 3.7 0.2 50 30 0.2 max. 3.7 4.2 4.2 3.9 4.4 4.4 100 60 1.2 v v v a ms notes 1: the detected voltage (v rst ) is defined as the voltage when reset occurs when the supply voltage (v dd ) is falling. 2: the detected voltage (v rst+ ) is defined as the voltage when reset is released when the supply voltage (v dd ) is rising from reset occurs. 3: when the voltage drop detection circuit is used (vdce pin = ??, i rst is added to i dd (power current). 4: the detection time (t rst ) is defined as the time until reset occurs when the supply voltage (v dd ) is falling to [v rst? ?0.1 v]. stck parameter pin (signal) name machine cycle mi mi+1 d 0 d 7 system clock port d output port d input ports p0, p1, p2, p3, p4, p5, p6 output ports p0, p1, p2, p3, p4, p5, p6 input d 0 d 7 int0, int1 interrupt input p0 0 p0 3 p1 0 p1 3 p0 0 p0 3 p1 0 p1 3 p2 0 p2 3 p3 0 p3 3 p2 0 p2 3 p3 0 p3 3 p4 0 p4 3 p4 0 p4 3 p5 0 p5 3 p6 0 p6 3 p5 0 p5 3 p6 0 p6 3 3.1.6 basic timing diagram 3.1.5 voltage drop detection circuit characteristics table 3.1.9 voltage drop detection circuit characteristics (ta = 20 c to 85 c, unless otherwise noted)
4519 group appendix 3.2 typical characteristics 3-11 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.2 typical characteristics as for the standard characteristics, refer to renesas technology corp. homepage. http://www.renesas.com/en/720
4519 group appendix 3.3 list of precautions 3-12 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3 list of precautions 3.3.1 program counter make sure that the pc h does not specify after the last page of the built-in rom. 3.3.2 stack registers (sk s ) stack registers (sks) are eight identical registers, so that subroutines can be nested up to 8 levels. however, one of stack registers is used respectively when using an interrupt service routine and when executing a table reference instruction. accordingly, be careful not to over the stack when performing these operations together. 3.3.3 notes on i/o port (1) note when an i/o port is used as an input port set the output latch to 1 and input the port value before input. if the output latch is set to 0, l level can be input. as for the port which has the output structure selection function, select the n-channel open-drain output structure. (2) noise and latch-up prevention connect an approximate 0.1 ? (3) multifunction be careful that the output of ports p3 0 and p3 1 can be used even when int0 and int1 pins are selected. be careful that the input of ports p2 0 ep2 2 can be used even when s in , s out and s ck pins are selected. be careful that the input/output of port d 6 can be used even when input of cntr0 pin is selected. be careful that the input of port d 6 can be used even when output of cntr0 pin is selected. be careful that the input/output of port d 7 can be used even when input of cntr1 pin is selected. be careful that the input of port d 7 can be used even when output of cntr1 pin is selected. (4) connection of unused pins table 3.3.1 shows the connections of unused pins. (5) sd, rd, szd instructions when the sd , rd , or szd instructions is used, do not set 1000 2 or more to register y. (6) port p3 0 /int0 pin when the ram back-up mode is used by clearing the bit 3 of register i1 to 0 and setting the input of int0 pin to be disabled, be careful about the following note. when the input of int0 pin is disabled (register i1 3 = 0), clear bit 0 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode. (7) port p3 1 /int1 pin when the ram back-up mode is used by clearing the bit 3 of register i2 to 0 and setting the input of int1 pin to be disabled, be careful about the following note. when the input of int1 pin is disabled (register i2 3 = 0), clear bit 2 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode.
4519 group appendix 3.3 list of precautions 3-13 rev.1.00 aug 06, 2004 rej09b0175-0100z connection open. open. open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to v ss . open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. open. connect to vss. pin x in x out d 0 ed 5 d 6 /cntr0 d 7 /cntr1 p0 0 ep0 3 p1 0 ep1 3 p2 0 /s ck p2 1 /s out p2 2 /s in p3 0 /int0 p3 1 /int1 p3 2 , p3 3 p4 0 /a in4 ep4 3 / a in7 p5 0 ep5 3 p6 0 /a in0 ep6 3 / a in3 usage condition internal oscillator is selected. ( note 1 ) internal oscillator is selected. ( note 1 ) rc oscillator is selected. ( note 2 ) external clock input is selected for main clock. ( note 3 ) n-channel open-drain is selected for the output structure. ( note 4 ) cntr0 input is not selected for timer 1 count source. n-channel open-drain is selected for the output structure. ( note 4 ) cntr1 input is not selected for timer 3 count source. n-channel open-drain is selected for the output structure. ( note 4 ) the key-on wakeup function is not selected. ( note 6 ) n-channel open-drain is selected for the output structure. ( note 5 ) the pull-up function is not selected. ( note 4 ) the key-on wakeup function is not selected. ( note 6 ) the key-on wakeup function is not selected. ( note 7 ) n-channel open-drain is selected for the output structure. ( note 5 ) the pull-up function is not selected. ( note 4 ) the key-on wakeup function is not selected. ( note 7 ) s ck pin is not selected. s in pin is not selected. 0 is set to output latch. 0 is set to output latch. n-channel open-drain is selected for the output structure. table 3.3.1 connections of unused pins notes 1: after system is released from reset, the internal oscillation (on-chip oscillator) is selected for system clock (rg 0 =0, mr 0 =1). 2: when the crck instruction is executed, the rc oscillation circuit becomes valid. be careful that the swich of system clock is not executed at oscillation start only by the crck instruction execution. in order to start oscillation, setting the main clock f(x in ) oscillation to be valid (mr 1 =0) is required. (if necessary, gen- erate the oscillation stabilizing wait time by software.) also, when the main clock (f(x in )) is selected as system clock, set the main clock f(x in ) oscillation (mr 1 =0) to be valid, and select main clock f(x in ) (mr 0 =0). be careful that the switch of system clock cannot be executed at the same time when main clock oscillation is started. 3: in order to use the external clock input for the main clock, select the ceramic resonance by executing the cmck in- struction at the beggining of software, and then set the main clock (f(x in )) oscillation to be valid (mr 1 =0). until the main clock (f(x in )) oscillation becomes valid (mr 1 =0) after ceramic resonance becomes valid, x in pin is fixed to h. when an external clock is used, insert a 1 k ?
4519 group appendix 3.3 list of precautions 3-14 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3.4 notes on interrupt (1) setting of int0 interrupt valid waveform set a value to the bit 2 of register i1, and execute the snz0 instruction to clear the exf0 flag to 0 after executing at least one instruction. depending on the input state of p3 0 /int0 pin, the external interrupt request flag (exf0) may be set to 1 when the bit 2 of register i1 is changed. (2) setting of int0 pin input control set a value to the bit 3 of register i1, and execute the snz0 instruction to clear the exf0 flag to 0 after executing at least one instruction. depending on the input state of p3 0 /int0 pin, the external interrupt request flag (exf0) may be set to 1 when the bit 3 of register i1 is changed. (3) setting of int1 interrupt valid waveform set a value to the bit 2 of register i2, and execute the snz1 instruction to clear the exf1 flag to 0 after executing at least one instruction. depending on the input state of p3 1 /int1 pin, the external interrupt request flag (exf1) may be set to 1 when the bit 2 of register i2 is changed. (4) setting of int1 pin input control set a value to the bit 3 of register i2, and execute the snz1 instruction to clear the exf1 flag to 0 after executing at least one instruction. depending on the input state of p3 1 /int1 pin, the external interrupt request flag (exf1) may be set to 1 when the bit 3 of register i2 is changed. (5) multiple interrupts multiple interrupts cannot be used in the 4519 group. (6) notes on interrupt processing when the interrupt occurs, at the same time, the interrupt enable flag inte is cleared to 0 (interrupt disable state). in order to enable the interrupt at the same time when system returns from the interrupt, write ei and rti instructions continuously. (7) p3 0 /int0 pin when the external interrupt input pin int0 is used, set the bit 3 of register i1 to 1. even in this case, port p3 0 i/o function is valid. also, the exf0 flag is set to 1 when bit 3 of register i1 is set to 1 by input of a valid waveform (valid waveform causing external 0 interrupt) even if it is used as an i/o port p3 0 . the input threshold characteristics (v ih /v il ) are different between int0 pin input and port p3 0 input. accordingly, note this difference when int0 pin input and port p3 0 input are used at the same time. (8) p3 1 /int1 pin when the external interrupt input pin int1 is used, set the bit 3 of register i2 to 1. even in this case, port p3 1 i/o function is valid. also, the exf1 flag is set to 1 when bit 3 of register i2 is set to 1 by input of a valid waveform (valid waveform causing external 1 interrupt) even if it is used as an i/o port p3 1 . the input threshold characteristics (v ih /v il ) are different between int1 pin input and port p3 1 input. accordingly, note this difference when int1 pin input and port p3 1 input are used at the same time. (9) pof instruction when the pof instruction is executed continuously after the epof instruction, system enters the ram back-up state. note that system cannot enter the ram back-up state when executing only the pof instruction. be sure to disable interrupts by executing the di instruction before executing the epof instruction and the pof instruction continuously.
4519 group appendix 3.3 list of precautions 3-15 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3.5 notes on timer (1) prescaler stop counting and then execute the tabps instruction to read from prescaler data. stop counting and then execute the tpsab instruction to set prescaler data. (2) count source stop timer 1, 2, 3, 4 or lc counting to change its count source. (3) reading the count values stop timer 1, 2, 3 or 4 counting and then execute the tab1 , tab2 , tab3 or tab4 instruction to read its data. (4) writing to the timer stop timer 1, 2, 3, 4 or lc counting and then execute the t1ab , t2ab , t3ab , t4ab or tlca instruction to write its data. (5) writing to reload register r1, reload register r3 and reload register r4h when writing data to reload register r1 while timer 1 is operating respectively, avoid a timing when timer 1 underflows. when writing data to reload register r3 while timer 3 is operating respectively, avoid a timing when timer 3 underflows. when writing data to reload register r4h while timer 4 is operating respectively, avoid a timing when timer 4 underflows. (6) timer 4 at cntr1 output vaild, if a timing of timer 4 underflow overlaps with a timing to stop timer 4, a hazard may be generated in a cntr1 output waveform. please review sufficiently. when h interval extension function of the pwm signal is set to be valid, set 01 16 or more to reload register r4h. (7) watchdog timer the watchdog timer function is valid after system is released from reset. when not using the watchdog timer function, stop the watchdog timer function and execute the dwdt instruction, the wrst instruction continuously, and clear the wef flag to 0. the watchdog timer function is valid after system is returned from the ram back-up state. when not using the watchdog timer function, stop the watchdog timer function and execute the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up state. when the watchdog timer function and ram back-up function are used at the same time, initialize the flag wdf1 with the wrst instruction before system enters into the ram back-up state. (8) pulse width input to cntr0 pin, cntr1 pin refer to section 3.1 electrical characteristics for rating value of pulse width input to cntr0 pin, cntr1 pin. (9) period measurement circuit
4519 group appendix 3.3 list of precautions 3-16 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 3.3.1 period measurement circuit program example [ nop ] [ snzt1 ] snzt1 instruction, insert the nop instruction. tab1 ] fig. 3.3.2 count start time and count time when operation starts (ps, t1, t2 and t3) fig. 3.3.3 count start time and count time when operation starts (t4) (10) prescaler, timer 1, timer 2 and timer 3 count start time and count time when operation starts count starts from the first rising edge of the count source ? ? ? ? (11) timer 4 count start time and count time when operation starts count starts from the rising edge ? ? ? ? ? ? ? ? ? ? ? ?
4519 group appendix 3.3 list of precautions 3-17 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3.6 notes on a/d conversion (1) note when the a/d conversion starts again when the a/d conversion starts again with the adst instruction during a/d conversion, the previous input data is invalidated and the a/d conversion starts again. (2) a/d converter-1 each analog input pin is equipped with a capacitor which is used to compare the analog voltage. accordingly, when the analog voltage is input from the circuit with high-impedance and, charge/ discharge noise is generated and the sufficient a/d accuracy may not be obtained. therefore, reduce the impedance or, connect a capacitor (0.01 fig. 3.3.4 analog input external circuit example-1 (3) notes for the use of a/d conversion 2 do not change the operating mode of the a/d converter by bit 3 of register q1 during a/d conversion (a/d conversion mode and comparator mode). (4) notes for the use of a/d conversion 3 when the operating mode of the a/d converter is changed from the comparator mode to the a/d conversion mode with bit 3 of register q1 in a program, be careful about the following notes. clear bit 2 of register v2 to 0 to change the operating mode of the a/d converter from the comparator mode to the a/d conversion mode (refer to figure 3.3.6 ? snzad instruction to clear the adf flag to 0. fig. 3.3.5 analog input external circuit example-2 s e n s o r a i n a p p l y t h e v o l t a g e w i t h i i n t h e s p e c i f i c a t i o n s t o a n a n a l o g i n p u t p i n . s e n s o r a i n a b o u t 1 k ? fig. 3.3.6 a/d converter operating mode program example clear bit 2 of register v2 to 0....... ? snzad instruction nop instruction for the case when a skip is performed with the snzad instruction
4519 group appendix 3.3 list of precautions 3-18 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) a/d converter is used at the comparator mode the analog input voltage is higher than the comparison voltage as a result of comparison, the contents of adf flag retains 0, not set to 1. in this case, the a/d interrupt does not occur even when the usage of the a/d interrupt is enabled. accordingly, consider the time until the comparator operation is completed, and examine the state of adf flag by software. the comparator operation is completed after 2 machine cycles + a/d conversion clock (adck) 1 clock. (6) analog input pins when p4 0 /a in4 ep4 3 /a in7 , p6 0 /a in0 ep6 3 /a in3 are set to pins for analog input, they cannot be used as i/o ports p4 and p6. (7) tala instruction when the tala instruction is executed, the low-order 2 bits of register ad is transferred to the high- order 2 bits of register a, and simultaneously, the low-order 2 bits of register a is 0. (8) recommended operating conditions when using a/d converter as for the supply voltage when a/d converter is used and the recommended operating condition of the a/d convesion clock frequency, refer to the 3.1 electrical characteristics. 3.3.7 notes on serial i/o (1) note when an external clock is used as a synchronous clock: an external clock is selected as the synchronous clock, the clock is not controlled internally. serial transmit/receive is continued as long as an external clock is input. if an external clock is input 9 times or more and serial transmit/receive is continued, the receive data is transferred directly as transmit data, so that be sure to control the clock externally. note also that the siof flag is set to 1 when a clock is counted 8 times. be sure to set the initial input level on the external clock pin to h level. refer to section 3.1 electrical characteristics when using serial i/o with an external clock. 3.3.8 notes on reset (1) register initial value the initial value of the following registers are undefined after system is released from reset. after system is released from reset, set initial values. register z (2 bits) register d (3 bits) register e (8 bits) (2) power-on reset when the built-in power-on reset circuit is used, the time for the supply voltage to rise from 0 v to the minimum rating value of the recommended operating conditions must be set to 100 s or less. if the rising time exceeds 100 s, connect a capacitor between the reset pin and v ss at the shortest distance, and input l level to reset pin until the value of supply voltage reaches the minimum rating value of the recommended operating conditions. refer to section 3.1 electrical characteristics for the reset voltage of the recommended operating conditions.
4519 group appendix 3.3 list of precautions 3-19 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3.9 notes on ram back-up (1) pof instruction execute the pof instruction immediately after executing the epof instruction to enter the ram back-up state. note that system cannot enter the ram back-up state when executing only the pof instruction. be sure to disable interrupts by executing the di instruction before executing the epof instruction and the pof instruction. (2) key-on wakeup function after checking none of the return condition for ports (p0, p1, int0 and int1 specified with register k0ek2) with valid key-on wakeup function is satisfied, execute the pof instruction. if at least one of return condition for ports with valid key-on wakeup function is satisfied, system returns from the ram back-upn state immediately after the pof instruction is executed. (3) return from ram back-up mode after system returns from ram back-up mode, set the undefined registers and flags. the initial value of the following registers are undefined at ram back-up. after system is returned from ram back-up mode, set initial values. register z (2 bits) register x (4 bits) register y (4 bits) (4) watchdog timer the watchdog timer function is valid after system is returned from the ram back-up state. when not using the watchdog timer function, stop the watchdog timer function with the dwdt instruction and the wrst instruction continuously every system is returned from the ram back-up. when the watchdog timer function and ram back-up function are used at the same time, initialize the flag wdf1 with the wrst instruction before system goes into the ram back-up state. (5) port p3 0 /int0 pin when the ram back-up mode is used by clearing the bit 3 of register i1 to 0 and setting the input of int0 pin to be disabled, be careful about the following note. when the input of int0 pin is disabled (register i1 3 = 0), clear bit 0 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode. (6) port p3 1 /int1 pin when the ram back-up mode is used by clearing the bit 3 of register i2 to 0 and setting the input of int1 pin to be disabled, be careful about the following note. when the input of int1 pin is disabled (register i2 3 = 0), clear bit 2 of register k2 to 0 to invalidate the key-on wakeup before system goes into the ram back-up mode. register d (3 bits) register e (8 bits)
4519 group appendix 3.3 list of precautions 3-20 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.3.10 notes on clock control (1) clock control execute the main clock (f(x in )) selection instruction ( cmck , crck or cyck instruction) in the initial setting routine of program (executing it in address 0 in page 0 is recommended). the oscillation circuit by the cmck , crck or cyck instruction can be selected only at once. the oscillation circuit corresponding to the first executed one of these instructions is valid. the cmck , crck or cyck instructions can be used only to select main clock (f(x in )). in this time, the start of oscillation and the switch of system clock are not performed. when the cmck , crck or cyck instructions are never executed, main clock (f(x in )) cannot be used and system can be operated only by on-chip oscillator. the no operated clock source (f(ring)) or (f(x in )) cannot be used for the system clock. also, the clock source (f(ring) or f(x in )) selected for the system clock cannot be stopped. (2) on-chip oscillator the clock frequency of the on-chip oscillator depends on the supply voltage and the operation temperature range. be careful that margin of frequencies when designing application products. when considering the oscillation stabilize wait time at the switch of clock, be careful that the margin of frequencies of the on-chip oscillator clock. (3) external clock when the external clock signal for the main clock (f(x in )) is used, connect the clock source to x in pin and x out pin open. in program, after the cmck instruction is executed, set main clock (f(x in )) oscillation start to be enabled (mr 1 =0). for this product, when ram back-up mode and main clock (f(x in )) stop (mr 1 =1), x in pin is fixed to h in order to avoid the through current by floating of internal logic. the x in pin is fixed to h until main clock (f(x in )) oscillation start to be valid (mr 1 =0) by the cmck instruction from reset state. accordingly, when an external clock is used, connect a 1 k ? (4) value of a part connected to an oscillator values of a capacitor and a resistor of the oscillation circuit depend on the connected oscillator and the board. accordingly, consult the oscillator manufacturer for values of each part connected the oscillator. 3.3.11 electric characteristic differences between mask rom and one time prom version mcu there are differences in electric characteristics, operation margin, noise immunity, and noise radiation between mask rom and one time prom version mcus due to the difference in the manufacturing processes. when manufacturing an application system with the one time prom version and then switching to use of the mask rom version, please perform sufficient evaluations for the commercial samples of the mask rom version. 3.3.12 note on power source voltage when the power source voltage value of a microcomputer is less than the value which is indicated as the recommended operating conditions, the microcomputer does not operate normally and may perform unstable operation. in a system where the power source voltage drops slowly when the power source voltage drops or the power supply is turned off, reset a microcomputer when the supply voltage is less than the recommended operating conditions and design a system not to cause errors to the system by this unstable operation.
4519 group appendix 3.4 notes on noise 3-21 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.4 notes on noise countermeasures against noise are described below. the following countermeasures are effective against noise in theory, however, it is necessary not only to take measures as follows but to evaluate before actual use. 3.4.1 shortest wiring length the wiring on a printed circuit board can function as an antenna which feeds noise into the microcomputer. the shorter the total wiring length (by mm unit), the less the possibility of noise insertion into a microcomputer. (1) package select the smallest possible package to make the total wiring length short. reason the wiring length depends on a microcom- puter package. use of a small package, for example qfp and not dip, makes the total wiring length short to reduce influence of noise. fig. 3.4.1 selection of packages (2) wiring for reset input pin make the length of wiring which is connected to the reset input pin as short as possible. especially, connect a capacitor across the reset input pin and the v ss pin with the shortest possible wiring. reason in order to reset a microcomputer correctly, 1 machine cycle or more of the width of a pulse input into the reset pin is required. if noise having a shorter pulse width than this is input to the reset input pin, the reset is released before the internal state of the microcomputer is completely initialized. this may cause a program runaway. dip sdip sop qfp fig. 3.4.2 wiring for the reset input pin reset reset circuit noise v ss v ss reset circuit v ss reset v ss n.g. o.k.
4519 group appendix 3.4 notes on noise 3-22 rev.1.00 aug 06, 2004 rej09b0175-0100z (3) wiring for clock input/output pins make the length of wiring which is connected to clock i/o pins as short as possible. make the length of wiring across the grounding lead of a capacitor which is connected to an oscillator and the v ss pin of a microcomputer as short as possible. separate the v ss pattern only for oscillation from other v ss patterns. fig. 3.4.3 wiring for clock i/o pins reason if noise enters clock i/o pins, clock waveforms may be deformed. this may cause a program failure or program runaway. also, if a potential difference is caused by the noise between the v ss level of a microcomputer and the v ss level of an oscillator, the correct clock will not be input in the microcomputer. fig. 3.4.4 wiring for cnv ss pin noise x in x out v ss x in x out v ss n.g. o.k. noise cnv ss v ss cnv ss v ss n.g. o.k. (4) wiring to cnv ss pin connect the cnv ss pin to the v ss pin with the shortest possible wiring. reason the operation mode of a microcomputer is influenced by a potential at the cnv ss pin. if a potential difference is caused by the noise between pins cnv ss and v ss , the operation mode may become unstable. this may cause a microcomputer malfunction or a program runaway.
4519 group appendix 3.4 notes on noise 3-23 rev.1.00 aug 06, 2004 rej09b0175-0100z (5) wiring to v pp pin of built-in prom version in the built-in prom version of the 4524 group, the cnv ss pin is also used as the built-in prom power supply input pin v pp . when the v pp pin is also used as the cnv ss pin connect an approximately 5 k ? resistor to the v pp pin the shortest possible in series and also to the v ss pin. when not connecting the resistor, make the length of wiring between the v pp pin and the v ss pin the shortest possible (refer to figure 3.4.5 ) note: even when a circuit which included an approximately 5 k ? resistor is used in the mask rom version, the microcomputer operates correctly. reason the v pp pin of the built-in prom version is the power source input pin for the built- in prom. when programming in the built- in prom, the impedance of the v pp pin is low to allow the electric current for writing flow into the prom. because of this, noise can enter easily. if noise enters the v pp pin, abnormal instruction codes or data are read from the built-in prom, which may cause a program runaway. fig. 3.4.5 wiring for the v pp pin of the built-in prom version cnv ss /v pp when the v pp pin is also used as the cnv ss pin v ss in the shortest distance approximately 5k ? 3.4.2 connection of bypass capacitor across v ss line and v dd line connect an approximately 0.1 f bypass capacitor across the v ss line and the v dd line as follows: connect a bypass capacitor across the v ss pin and the v dd pin at equal length. connect a bypass capacitor across the v ss pin and the v dd pin with the shortest possible wiring. use lines with a larger diameter than other signal lines for v ss line and v dd line. connect the power source wiring via a bypass capacitor to the v ss pin and the v dd pin. fig. 3.4.6 bypass capacitor across the v ss line and the v dd line v ss v dd aa aa aa aa aa aa v ss v dd aa aa aa aa aa aa aa aa aa aa n.g. o.k.
4519 group appendix 3.4 notes on noise 3-24 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.4.3 wiring to analog input pins connect an approximately 100 ? to 1 k ? resistor to an analog signal line which is connected to an analog input pin in series. besides, connect the resistor to the microcomputer as close as possible. connect an approximately 1000 pf capacitor across the v ss pin and the analog input pin. besides, connect the capacitor to the v ss pin as close as possible. also, connect the capacitor across the analog input pin and the v ss pin at equal length. reason signals which is input in an analog input pin (such as an a/d converter/comparator input pin) are usually output signals from sensor. the sensor which detects a change of event is installed far from the printed circuit board with a microcomputer, the wiring to an analog input pin is longer necessarily. this long wiring functions as an antenna which feeds noise into the microcomputer, which causes noise to an analog input pin. fig. 3.4.7 analog signal line and a resistor and a capacitor 3.4.4 oscillator concerns take care to prevent an oscillator that generates clocks for a microcomputer operation from being affected by other signals. (1) keeping oscillator away from large current signal lines install a microcomputer (and especially an oscillator) as far as possible from signal lines where a current larger than the tolerance of current value flows. reason in the system using a microcomputer, there are signal lines for controlling motors, leds, and thermal heads or others. when a large current flows through those signal lines, strong noise occurs because of mutual inductance. fig. 3.4.8 wiring for a large current signal line x in x out v ss m microcomputer mutual inductance large current gnd analog input pin v ss noise thermistor microcomputer n.g. o.k. (note) note : the resistor is used for dividing resistance with a thermistor.
4519 group appendix 3.4 notes on noise 3-25 rev.1.00 aug 06, 2004 rej09b0175-0100z fig. 3.4.9 wiring to a signal line where potential levels change frequently (3) oscillator protection using v ss pattern as for a two-sided printed circuit board, print a v ss pattern on the underside (soldering side) of the position (on the component side) where an oscillator is mounted. connect the v ss pattern to the microcomputer v ss pin with the shortest possible wiring. besides, separate this v ss pattern from other v ss patterns. x in x out v ss m microcomputer mutual inductance large current gnd 3.4.5 setup for i/o ports setup i/o ports using hardware and software as follows: connect a resistor of 100 ? or more to an i/o port in series. as for an input port, read data several times by a program for checking whether input levels are equal or not. as for an output port or an i/o port, since the output data may reverse because of noise, rewrite data to its output latch at fixed periods. rewrite data to pull-up control registers at fixed periods. 3.4.6 providing of watchdog timer function by software if a microcomputer runs away because of noise or others, it can be detected by a software watchdog timer and the microcomputer can be reset to normal operation. this is equal to or more effective than program runaway detection by a hardware watchdog timer. the following shows an example of a watchdog timer provided by software. in the following example, to reset a microcomputer to normal operation, the main routine detects errors of the interrupt processing routine and the interrupt processing routine detects errors of the main routine. this example assumes that interrupt processing is repeated multiple times in a single main routine processing. (2) installing oscillator away from signal lines where potential levels change frequently install an oscillator and a connecting pattern of an oscillator away from signal lines where potential levels change frequently. also, do not cross such signal lines over the clock lines or the signal lines which are sensitive to noise. reason signal lines where potential levels change frequently (such as the cntr pin signal line) may affect other lines at signal rising edge or falling edge. if such lines cross over a clock line, clock waveforms may be deformed, which causes a microcomputer failure or a program runaway. fig. 3.4.10 v ss pattern on the underside of an oscillator aaa aaa aaa aaa a a a aaa a a a a a aa aa x in x out v ss an example of v ss patterns on the underside of a printed circuit board oscillator wiring pattern example separate the v ss line for oscillation from other v ss lines
4519 group appendix 3.4 notes on noise 3-26 rev.1.00 aug 06, 2004 rej09b0175-0100z assigns a single word of ram to a software watchdog timer (swdt) and writes the initial value n in the swdt once at each execution of the main routine. the initial value n should satisfy the following condition: n+1 as the main routine execution cycle may change because of an interrupt processing or others, the initial value n should have a margin. watches the operation of the interrupt processing routine by comparing the swdt contents with counts of interrupt processing after the initial value n has been set. detects that the interrupt processing routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents do not change after interrupt processing. decrements the swdt contents by 1 at each interrupt processing. determines that the main routine operates normally when the swdt contents are reset to the initial value n at almost fixed cycles (at the fixed interrupt processing count). detects that the main routine has failed and determines to branch to the program initialization routine for recovery processing in the following case: if the swdt contents are not initialized to the initial value n but continued to decrement and if they reach 0 or less. fig. 3.4.11 watchdog timer by software (counts of interrupt processing executed in each main routine) main routine (swdt) n ei main processing (swdt) interrupt processing routine errors n interrupt processing routine (swdt) (swdt) 1 interrupt processing (swdt) main routine errors > 0 0 rti return =n? 0? n
4519 group appendix 3.5 package outline 3-27 rev.1.00 aug 06, 2004 rej09b0175-0100z 3.5 package outline ssop42-p-450-0.80 weight(g) e jedec code 0.63 eiaj package code lead material alloy 42/cu alloy 42p2r-a plastic 42pin 450mil ssop symbol min nom max a a 2 b c d e l l 1 y dimension in millimeters h e a 1 i 2 e e .35 0 .05 0 .13 0 .3 17 .2 8 e .63 11 .3 0 e e e .27 1 e e .0 2 .4 0 .15 0 .5 17 .4 8 .8 0 .93 11 .5 0 .765 1 e .43 11 e e .4 2 e .5 0 .2 0 .7 17 .6 8 e .23 12 .7 0 e .15 0 e b 2 e.5 0e e 0
renesas 4-bit cisc single-chip microcomputer user? manual 4519 group publication data : rev.1.00 aug 08, 2004 published by : sales strategic planning div. renesas technology corp. 2004. renesas technology corp., all rights reserved. printed in japan.
4519 group user's manual 2-6-2, ote-machi, chiyoda-ku, tokyo, 100-0004, japan


▲Up To Search▲   

 
Price & Availability of M34519M6-XXXFP

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X